How to use form.submit method in Appium Xcuitest Driver

Best JavaScript code snippet using appium-xcuitest-driver

delivery.js

Source:delivery.js Github

copy

Full Screen

1<%-- JAVSCRIPT FOR DISABLING SHOWFEEDBACK AND TOC AFTER ONE CLICK 2Note that this will be embedded in the page exactly as is3--%><!-- Samigo embedded delivery.js starts here -->4<script type="text/javascript">5function printForm(){6 alert("print 0");7 for(i=0; i<document.forms[0].elements.length; i++)8 {9 alert("The field name is: " + document.forms[0].elements[i].name); 10 }11}12function printLink(){13 for (var i=0; i < document.links.length; i++){14 alert(document.links[i].id);15 }16}17var beginAssessment1Disabled = 'false';18function disableBeginAssessment1(){19 if (beginAssessment1Disabled === 'false'){20 beginAssessment1Disabled = 'true';21 if (document.forms[0].elements['takeAssessmentForm:beginAssessment2'])22 document.forms[0].elements['takeAssessmentForm:beginAssessment2'].disabled=true;23 if (document.forms[0].elements['takeAssessmentForm:beginAssessment3'])24 document.forms[0].elements['takeAssessmentForm:beginAssessment3'].disabled=true;25 if (document.forms[0].elements['takeAssessmentForm:cancel1'])26 document.forms[0].elements['takeAssessmentForm:cancel1'].disabled=true;27 if (document.forms[0].elements['takeAssessmentForm:cancel2'])28 document.forms[0].elements['takeAssessmentForm:cancel2'].disabled=true;29 }30 else{ // any subsequent click disable feeback link & action31 if (document.forms[0].elements['takeAssessmentForm:beginAssessment1'])32 document.forms[0].elements['takeAssessmentForm:beginAssessment1'].disabled=true;33 }34}35var beginAssessment2Disabled = 'false';36function disableBeginAssessment2(){37 if (beginAssessment2Disabled === 'false'){38 beginAssessment2Disabled = 'true';39 if (document.forms[0].elements['takeAssessmentForm:beginAssessment1'])40 document.forms[0].elements['takeAssessmentForm:beginAssessment1'].disabled=true;41 if (document.forms[0].elements['takeAssessmentForm:beginAssessment3'])42 document.forms[0].elements['takeAssessmentForm:beginAssessment3'].disabled=true;43 if (document.forms[0].elements['takeAssessmentForm:cancel1'])44 document.forms[0].elements['takeAssessmentForm:cancel1'].disabled=true;45 if (document.forms[0].elements['takeAssessmentForm:cancel2'])46 document.forms[0].elements['takeAssessmentForm:cancel2'].disabled=true;47 }48 else{ // any subsequent click disable feeback link & action49 if (document.forms[0].elements['takeAssessmentForm:beginAssessment2'])50 document.forms[0].elements['takeAssessmentForm:beginAssessment2'].disabled=true;51 }52}53var beginAssessment3Disabled = 'false';54function disableBeginAssessment3(){55 if (beginAssessment3Disabled === 'false'){56 beginAssessment3Disabled = 'true';57 if (document.forms[0].elements['takeAssessmentForm:beginAssessment1'])58 document.forms[0].elements['takeAssessmentForm:beginAssessment1'].disabled=true;59 if (document.forms[0].elements['takeAssessmentForm:beginAssessment2'])60 document.forms[0].elements['takeAssessmentForm:beginAssessment2'].disabled=true;61 if (document.forms[0].elements['takeAssessmentForm:cancel1'])62 document.forms[0].elements['takeAssessmentForm:cancel1'].disabled=true;63 if (document.forms[0].elements['takeAssessmentForm:cancel2'])64 document.forms[0].elements['takeAssessmentForm:cancel2'].disabled=true;65 }66 else{ // any subsequent click disable feeback link & action67 if (document.forms[0].elements['takeAssessmentForm:beginAssessment3'])68 document.forms[0].elements['takeAssessmentForm:beginAssessment3'].disabled=true;69 }70}71var cancel1Disabled = 'false';72function disableCancel1(){73 if (cancel1Disabled === 'false'){74 cancel1Disabled = 'true';75 if (document.forms[0].elements['takeAssessmentForm:beginAssessment1'])76 document.forms[0].elements['takeAssessmentForm:beginAssessment1'].disabled=true;77 if (document.forms[0].elements['takeAssessmentForm:beginAssessment2'])78 document.forms[0].elements['takeAssessmentForm:beginAssessment2'].disabled=true;79 if (document.forms[0].elements['takeAssessmentForm:beginAssessment3'])80 document.forms[0].elements['takeAssessmentForm:beginAssessment3'].disabled=true;81 if (document.forms[0].elements['takeAssessmentForm:cancel2'])82 document.forms[0].elements['takeAssessmentForm:cancel2'].disabled=true;83 }84 else{ // any subsequent click disable feeback link & action85 if (document.forms[0].elements['takeAssessmentForm:cancel1'])86 document.forms[0].elements['takeAssessmentForm:cancel1'].disabled=true;87 }88}89var cancel2Disabled = 'false';90function disableCancel2(){91 if (cancel2Disabled === 'false'){92 cancel2Disabled = 'true';93 if (document.forms[0].elements['takeAssessmentForm:beginAssessment1'])94 document.forms[0].elements['takeAssessmentForm:beginAssessment1'].disabled=true;95 if (document.forms[0].elements['takeAssessmentForm:beginAssessment2'])96 document.forms[0].elements['takeAssessmentForm:beginAssessment2'].disabled=true;97 if (document.forms[0].elements['takeAssessmentForm:beginAssessment3'])98 document.forms[0].elements['takeAssessmentForm:beginAssessment3'].disabled=true;99 if (document.forms[0].elements['takeAssessmentForm:cancel1'])100 document.forms[0].elements['takeAssessmentForm:cancel1'].disabled=true;101 }102 else{ // any subsequent click disable feeback link & action103 if (document.forms[0].elements['takeAssessmentForm:cancel2'])104 document.forms[0].elements['takeAssessmentForm:cancel2'].disabled=true;105 }106}107var submitForGradeTOC1Disabled = 'false';108function disableSubmitForGradeTOC1(){109 if (submitForGradeTOC1Disabled === 'false'){110 submitForGradeTOC1Disabled = 'true';111 if (document.forms[0].elements['tableOfContentsForm:submitForGradeTOC2'])112 document.forms[0].elements['tableOfContentsForm:submitForGradeTOC2'].disabled=true;113 if (document.forms[0].elements['tableOfContentsForm:exitTOC1'])114 document.forms[0].elements['tableOfContentsForm:exitTOC1'].disabled=true;115 if (document.forms[0].elements['tableOfContentsForm:exitTOC2'])116 document.forms[0].elements['tableOfContentsForm:exitTOC2'].disabled=true;117 }118 else{ // any subsequent click disable feeback link & action119 if (document.forms[0].elements['tableOfContentsForm:submitForGradeTOC1'])120 document.forms[0].elements['tableOfContentsForm:submitForGradeTOC1'].disabled=true;121 }122}123var submitForGradeTOC2Disabled = 'false';124function disableSubmitForGradeTOC2(){125 if (submitForGradeTOC2Disabled === 'false'){126 submitForGradeTOC2Disabled = 'true';127 if (document.forms[0].elements['tableOfContentsForm:submitForGradeTOC1'])128 document.forms[0].elements['tableOfContentsForm:submitForGradeTOC1'].disabled=true;129 if (document.forms[0].elements['tableOfContentsForm:exitTOC1'])130 document.forms[0].elements['tableOfContentsForm:exitTOC1'].disabled=true;131 if (document.forms[0].elements['tableOfContentsForm:exitTOC2'])132 document.forms[0].elements['tableOfContentsForm:exitTOC2'].disabled=true;133 }134 else{ // any subsequent click disable feeback link & action135 if (document.forms[0].elements['tableOfContentsForm:submitForGradeTOC2'])136 document.forms[0].elements['tableOfContentsForm:submitForGradeTOC2'].disabled=true;137 }138}139var exitTOC1Disabled = 'false';140function disableExitTOC1(){141 if (exitTOC1Disabled === 'false'){142 exitTOC1Disabled = 'true';143 if (document.forms[0].elements['tableOfContentsForm:submitForGradeTOC1'])144 document.forms[0].elements['tableOfContentsForm:submitForGradeTOC1'].disabled=true;145 if (document.forms[0].elements['tableOfContentsForm:submitForGradeTOC2'])146 document.forms[0].elements['tableOfContentsForm:submitForGradeTOC2'].disabled=true;147 if (document.forms[0].elements['tableOfContentsForm:exitTOC2'])148 document.forms[0].elements['tableOfContentsForm:exitTOC2'].disabled=true;149 }150 else{ // any subsequent click disable feeback link & action151 if (document.forms[0].elements['tableOfContentsForm:exitTOC1'])152 document.forms[0].elements['tableOfContentsForm:exitTOC1'].disabled=true;153 }154}155var exitTOC2Disabled = 'false';156function disableExitTOC2(){157 if (exitTOC2Disabled === 'false'){158 exitTOC2Disabled = 'true';159 if (document.forms[0].elements['tableOfContentsForm:submitForGradeTOC1'])160 document.forms[0].elements['tableOfContentsForm:submitForGradeTOC1'].disabled=true;161 if (document.forms[0].elements['tableOfContentsForm:submitForGradeTOC2'])162 document.forms[0].elements['tableOfContentsForm:submitForGradeTOC2'].disabled=true;163 if (document.forms[0].elements['tableOfContentsForm:exitTOC1'])164 document.forms[0].elements['tableOfContentsForm:exitTOC1'].disabled=true;165 }166 else{ // any subsequent click disable feeback link & action167 if (document.forms[0].elements['tableOfContentsForm:exitTOC2'])168 document.forms[0].elements['tableOfContentsForm:exitTOC2'].disabled=true;169 }170}171var disabledFeedback = 'false';172function disableFeedback(){173 if (disabledFeedback === 'false'){174 disabledFeedback = 'true';175 for (var i=0; i < document.links.length; i++){176 if (document.links[i].id === 'takeAssessmentForm:assessmentDeliveryHeading:showTOC')177 document.links[i].disabled = true;178 }179 if (document.forms[0].elements['takeAssessmentForm:next'])180 document.forms[0].elements['takeAssessmentForm:next'].disabled=true;181 if (document.forms[0].elements['takeAssessmentForm:previous'])182 document.forms[0].elements['takeAssessmentForm:previous'].disabled=true;183 if (document.forms[0].elements['takeAssessmentForm:save'])184 document.forms[0].elements['takeAssessmentForm:save'].disabled=true;185 if (document.forms[0].elements['takeAssessmentForm:saveAndExit'])186 document.forms[0].elements['takeAssessmentForm:saveAndExit'].disabled=true;187 if (document.forms[0].elements['takeAssessmentForm:saveAndExit2'])188 document.forms[0].elements['takeAssessmentForm:saveAndExit2'].disabled=true;189 if (document.forms[0].elements['takeAssessmentForm:submitForm'])190 document.forms[0].elements['takeAssessmentForm:submitForm'].disabled=true;191 if (document.forms[0].elements['takeAssessmentForm:submitForm1'])192 document.forms[0].elements['takeAssessmentForm:submitForm1'].disabled=true;193 if (document.forms[0].elements['takeAssessmentForm:quit'])194 document.forms[0].elements['takeAssessmentForm:quit'].disabled=true;195 if (document.forms[0].elements['takeAssessmentForm:submitForGrade'])196 document.forms[0].elements['takeAssessmentForm:submitForGrade'].disabled=true;197 }198 else{ // any subsequent click disable feeback link & action199 for (var i=0; i < document.links.length; i++){200 if (document.links[i].id == 'takeAssessmentForm:assessmentDeliveryHeading:showFeedback')201 document.links[i].disabled = true;202 }203 }204}205var disabledTOC = 'false';206function disableTOC(){207 if (disabledTOC === 'false'){208 disabledTOC = 'true';209 for (var i=0; i < document.links.length; i++){210 if (document.links[i].id == 'takeAssessmentForm:assessmentDeliveryHeading:showFeedback')211 document.links[i].disabled = true;212 }213 if (document.forms[0].elements['takeAssessmentForm:next'])214 document.forms[0].elements['takeAssessmentForm:next'].disabled=true;215 if (document.forms[0].elements['takeAssessmentForm:previous'])216 document.forms[0].elements['takeAssessmentForm:previous'].disabled=true;217 if (document.forms[0].elements['takeAssessmentForm:save'])218 document.forms[0].elements['takeAssessmentForm:save'].disabled=true; 219 if (document.forms[0].elements['takeAssessmentForm:saveAndExit'])220 document.forms[0].elements['takeAssessmentForm:saveAndExit'].disabled=true;221 if (document.forms[0].elements['takeAssessmentForm:saveAndExit2'])222 document.forms[0].elements['takeAssessmentForm:saveAndExit2'].disabled=true;223 if (document.forms[0].elements['takeAssessmentForm:submitForm'])224 document.forms[0].elements['takeAssessmentForm:submitForm'].disabled=true;225 if (document.forms[0].elements['takeAssessmentForm:submitForm1'])226 document.forms[0].elements['takeAssessmentForm:submitForm1'].disabled=true;227 if (document.forms[0].elements['takeAssessmentForm:quit'])228 document.forms[0].elements['takeAssessmentForm:quit'].disabled=true;229 if (document.forms[0].elements['takeAssessmentForm:submitForGrade'])230 document.forms[0].elements['takeAssessmentForm:submitForGrade'].disabled=true;231 }232 else{ // any subsequent click disable feeback link & action233 for (var i=0; i < document.links.length; i++){234 if (document.links[i].id == 'takeAssessmentForm:assessmentDeliveryHeading:showTOC')235 document.links[i].disabled = true;236 }237 }238}239function disableTOCFeedback(){240 for (var i=0; i < document.links.length; i++){241 if (document.links[i].id == 'takeAssessmentForm:assessmentDeliveryHeading:showTOC')242 document.links[i].disabled = true;243 if (document.links[i].id == 'takeAssessmentForm:assessmentDeliveryHeading:showFeedback')244 document.links[i].disabled = true;245 }246}247var nextDisabled = 'false';248function disableNext(){249 if (nextDisabled === 'false'){250 nextDisabled = 'true';251 disableTOCFeedback();252 if (document.forms[0].elements['takeAssessmentForm:previous'])253 document.forms[0].elements['takeAssessmentForm:previous'].disabled=true;254 if (document.forms[0].elements['takeAssessmentForm:quit'])255 document.forms[0].elements['takeAssessmentForm:quit'].disabled=true;256 if (document.forms[0].elements['takeAssessmentForm:save'])257 document.forms[0].elements['takeAssessmentForm:save'].disabled=true; 258 if (document.forms[0].elements['takeAssessmentForm:saveAndExit'])259 document.forms[0].elements['takeAssessmentForm:saveAndExit'].disabled=true;260 if (document.forms[0].elements['takeAssessmentForm:saveAndExit2'])261 document.forms[0].elements['takeAssessmentForm:saveAndExit2'].disabled=true;262 if (document.forms[0].elements['takeAssessmentForm:submitForm'])263 document.forms[0].elements['takeAssessmentForm:submitForm'].disabled=true;264 if (document.forms[0].elements['takeAssessmentForm:submitForm1'])265 document.forms[0].elements['takeAssessmentForm:submitForm1'].disabled=true;266 if (document.forms[0].elements['takeAssessmentForm:submitForGrade'])267 document.forms[0].elements['takeAssessmentForm:submitForGrade'].disabled=true;268 }269 else{ // any subsequent click disable button & action270 if (document.forms[0].elements['takeAssessmentForm:next'])271 document.forms[0].elements['takeAssessmentForm:next'].disabled=true;272 }273}274var previousDisabled = 'false';275function disablePrevious(){276 if (previousDisabled === 'false'){277 previousDisabled = 'true';278 disableTOCFeedback();279 if (document.forms[0].elements['takeAssessmentForm:next'])280 document.forms[0].elements['takeAssessmentForm:next'].disabled=true;281 if (document.forms[0].elements['takeAssessmentForm:quit'])282 document.forms[0].elements['takeAssessmentForm:quit'].disabled=true;283 if (document.forms[0].elements['takeAssessmentForm:save'])284 document.forms[0].elements['takeAssessmentForm:save'].disabled=true; 285 if (document.forms[0].elements['takeAssessmentForm:saveAndExit'])286 document.forms[0].elements['takeAssessmentForm:saveAndExit'].disabled=true;287 if (document.forms[0].elements['takeAssessmentForm:saveAndExit2'])288 document.forms[0].elements['takeAssessmentForm:saveAndExit2'].disabled=true;289 if (document.forms[0].elements['takeAssessmentForm:submitForm'])290 document.forms[0].elements['takeAssessmentForm:submitForm'].disabled=true;291 if (document.forms[0].elements['takeAssessmentForm:submitForm1'])292 document.forms[0].elements['takeAssessmentForm:submitForm1'].disabled=true;293 if (document.forms[0].elements['takeAssessmentForm:submitForGrade'])294 document.forms[0].elements['takeAssessmentForm:submitForGrade'].disabled=true;295 }296 else{ // any subsequent click disable button & action297 if (document.forms[0].elements['takeAssessmentForm:previous'])298 document.forms[0].elements['takeAssessmentForm:previous'].disabled=true;299 }300}301var submitDisabled = 'false';302function disableSubmit(){303 if (submitDisabled === 'false'){304 submitDisabled = 'true';305 disableTOCFeedback();306 if (document.forms[0].elements['takeAssessmentForm:next'])307 document.forms[0].elements['takeAssessmentForm:next'].disabled=true;308 if (document.forms[0].elements['takeAssessmentForm:previous'])309 document.forms[0].elements['takeAssessmentForm:previous'].disabled=true;310 if (document.forms[0].elements['takeAssessmentForm:quit'])311 document.forms[0].elements['takeAssessmentForm:quit'].disabled=true;312 if (document.forms[0].elements['takeAssessmentForm:save'])313 document.forms[0].elements['takeAssessmentForm:save'].disabled=true; 314 if (document.forms[0].elements['takeAssessmentForm:saveAndExit'])315 document.forms[0].elements['takeAssessmentForm:saveAndExit'].disabled=true;316 if (document.forms[0].elements['takeAssessmentForm:saveAndExit2'])317 document.forms[0].elements['takeAssessmentForm:saveAndExit2'].disabled=true;318 if (document.forms[0].elements['takeAssessmentForm:submitForm1'])319 document.forms[0].elements['takeAssessmentForm:submitForm1'].disabled=true;320 if (document.forms[0].elements['takeAssessmentForm:submitForGrade'])321 document.forms[0].elements['takeAssessmentForm:submitForGrade'].disabled=true;322 }323 else{ // any subsequent click disable button & action324 if (document.forms[0].elements['takeAssessmentForm:submitForm'])325 document.forms[0].elements['takeAssessmentForm:submitForm'].disabled=true;326 }327}328var submit1Disabled = 'false';329function disableSubmit1(){330 if (submit1Disabled === 'false'){331 submit1Disabled = 'true';332 disableTOCFeedback();333 if (document.forms[0].elements['takeAssessmentForm:next'])334 document.forms[0].elements['takeAssessmentForm:next'].disabled=true;335 if (document.forms[0].elements['takeAssessmentForm:previous'])336 document.forms[0].elements['takeAssessmentForm:previous'].disabled=true;337 if (document.forms[0].elements['takeAssessmentForm:quit'])338 document.forms[0].elements['takeAssessmentForm:quit'].disabled=true;339 if (document.forms[0].elements['takeAssessmentForm:save'])340 document.forms[0].elements['takeAssessmentForm:save'].disabled=true; 341 if (document.forms[0].elements['takeAssessmentForm:saveAndExit'])342 document.forms[0].elements['takeAssessmentForm:saveAndExit'].disabled=true;343 if (document.forms[0].elements['takeAssessmentForm:saveAndExit2'])344 document.forms[0].elements['takeAssessmentForm:saveAndExit2'].disabled=true;345 if (document.forms[0].elements['takeAssessmentForm:submitForm'])346 document.forms[0].elements['takeAssessmentForm:submitForm'].disabled=true;347 if (document.forms[0].elements['takeAssessmentForm:submitForGrade'])348 document.forms[0].elements['takeAssessmentForm:submitForGrade'].disabled=true;349 }350 else{ // any subsequent click disable button & action351 if (document.forms[0].elements['takeAssessmentForm:submitForm1'])352 document.forms[0].elements['takeAssessmentForm:submitForm1'].disabled=true;353 }354}355var saveDisabled = 'false';356function disableSave(){357 if (saveDisabled === 'false'){358 saveDisabled = 'true';359 disableTOCFeedback();360 if (document.forms[0].elements['takeAssessmentForm:next'])361 document.forms[0].elements['takeAssessmentForm:next'].disabled=true;362 if (document.forms[0].elements['takeAssessmentForm:previous'])363 document.forms[0].elements['takeAssessmentForm:previous'].disabled=true;364 if (document.forms[0].elements['takeAssessmentForm:quit'])365 document.forms[0].elements['takeAssessmentForm:quit'].disabled=true;366 if (document.forms[0].elements['takeAssessmentForm:saveAndExit'])367 document.forms[0].elements['takeAssessmentForm:saveAndExit'].disabled=true;368 if (document.forms[0].elements['takeAssessmentForm:saveAndExit2'])369 document.forms[0].elements['takeAssessmentForm:saveAndExit2'].disabled=true;370 if (document.forms[0].elements['takeAssessmentForm:submitForm'])371 document.forms[0].elements['takeAssessmentForm:submitForm'].disabled=true;372 if (document.forms[0].elements['takeAssessmentForm:submitForm1'])373 document.forms[0].elements['takeAssessmentForm:submitForm1'].disabled=true;374 if (document.forms[0].elements['takeAssessmentForm:submitForGrade'])375 document.forms[0].elements['takeAssessmentForm:submitForGrade'].disabled=true;376 }377 else{ // any subsequent click disable button & action378 if (document.forms[0].elements['takeAssessmentForm:save'])379 document.forms[0].elements['takeAssessmentForm:save'].disabled=true;380 }381}382var saveDisabled = 'false';383function disableSaveAndExit(){384 if (saveDisabled === 'false'){385 saveDisabled = 'true';386 disableTOCFeedback();387 if (document.forms[0].elements['takeAssessmentForm:next'])388 document.forms[0].elements['takeAssessmentForm:next'].disabled=true;389 if (document.forms[0].elements['takeAssessmentForm:previous'])390 document.forms[0].elements['takeAssessmentForm:previous'].disabled=true;391 if (document.forms[0].elements['takeAssessmentForm:quit'])392 document.forms[0].elements['takeAssessmentForm:quit'].disabled=true;393 if (document.forms[0].elements['takeAssessmentForm:save'])394 document.forms[0].elements['takeAssessmentForm:save'].disabled=true; 395 if (document.forms[0].elements['takeAssessmentForm:saveAndExit2'])396 document.forms[0].elements['takeAssessmentForm:saveAndExit2'].disabled=true;397 if (document.forms[0].elements['takeAssessmentForm:submitForm'])398 document.forms[0].elements['takeAssessmentForm:submitForm'].disabled=true;399 if (document.forms[0].elements['takeAssessmentForm:submitForm1'])400 document.forms[0].elements['takeAssessmentForm:submitForm1'].disabled=true;401 if (document.forms[0].elements['takeAssessmentForm:submitForGrade'])402 document.forms[0].elements['takeAssessmentForm:submitForGrade'].disabled=true;403 }404 else{ // any subsequent click disable button & action405 if (document.forms[0].elements['takeAssessmentForm:saveAndExit'])406 document.forms[0].elements['takeAssessmentForm:saveAndExit'].disabled=true;407 }408}409var saveDisabled2 = 'false';410function disableSaveAndExit2(){411 if (saveDisabled2 === 'false'){412 saveDisabled2 = 'true';413 disableTOCFeedback();414 if (document.forms[0].elements['takeAssessmentForm:next'])415 document.forms[0].elements['takeAssessmentForm:next'].disabled=true;416 if (document.forms[0].elements['takeAssessmentForm:previous'])417 document.forms[0].elements['takeAssessmentForm:previous'].disabled=true;418 if (document.forms[0].elements['takeAssessmentForm:quit'])419 document.forms[0].elements['takeAssessmentForm:quit'].disabled=true;420 if (document.forms[0].elements['takeAssessmentForm:save'])421 document.forms[0].elements['takeAssessmentForm:save'].disabled=true; 422 if (document.forms[0].elements['takeAssessmentForm:saveAndExit'])423 document.forms[0].elements['takeAssessmentForm:saveAndExit'].disabled=true;424 if (document.forms[0].elements['takeAssessmentForm:submitForm'])425 document.forms[0].elements['takeAssessmentForm:submitForm'].disabled=true;426 if (document.forms[0].elements['takeAssessmentForm:submitForm1'])427 document.forms[0].elements['takeAssessmentForm:submitForm1'].disabled=true;428 if (document.forms[0].elements['takeAssessmentForm:submitForGrade'])429 document.forms[0].elements['takeAssessmentForm:submitForGrade'].disabled=true;430 }431 else{ // any subsequent click disable button & action432 if (document.forms[0].elements['takeAssessmentForm:saveAndExit2'])433 document.forms[0].elements['takeAssessmentForm:saveAndExit2'].disabled=true;434 }435}436var cancelDisabled = 'false';437function disableCancel(){438 if (cancelDisabled === 'false'){439 cancelDisabled = 'true';440 if (document.forms[0].elements['takeAssessmentForm:previous'])441 document.forms[0].elements['takeAssessmentForm:previous'].disabled=true;442 if (document.forms[0].elements['takeAssessmentForm:submitForm'])443 document.forms[0].elements['takeAssessmentForm:submitForm'].disabled=true;444 if (document.forms[0].elements['takeAssessmentForm:submitForm1'])445 document.forms[0].elements['takeAssessmentForm:submitForm1'].disabled=true;446 if (document.forms[0].elements['takeAssessmentForm:submitForGrade'])447 document.forms[0].elements['takeAssessmentForm:submitForGrade'].disabled=true;448 }449 else{ // any subsequent click disable button & action450 if (document.forms[0].elements['takeAssessmentForm:cancel'])451 document.forms[0].elements['takeAssessmentForm:cancel'].disabled=true;452 }453}454var quitDisabled = 'false';455function disableQuit(){456 if (quitDisabled === 'false'){457 quitDisabled = 'true';458 disableTOCFeedback();459 if (document.forms[0].elements['takeAssessmentForm:next'])460 document.forms[0].elements['takeAssessmentForm:next'].disabled=true;461 if (document.forms[0].elements['takeAssessmentForm:previous'])462 document.forms[0].elements['takeAssessmentForm:previous'].disabled=true;463 if (document.forms[0].elements['takeAssessmentForm:saveAndExit'])464 document.forms[0].elements['takeAssessmentForm:saveAndExit'].disabled=true;465 if (document.forms[0].elements['takeAssessmentForm:saveAndExit2'])466 document.forms[0].elements['takeAssessmentForm:saveAndExit2'].disabled=true;467 if (document.forms[0].elements['takeAssessmentForm:submitForm'])468 document.forms[0].elements['takeAssessmentForm:submitForm'].disabled=true;469 if (document.forms[0].elements['takeAssessmentForm:submitForm1'])470 document.forms[0].elements['takeAssessmentForm:submitForm1'].disabled=true;471 if (document.forms[0].elements['takeAssessmentForm:submitForGrade'])472 document.forms[0].elements['takeAssessmentForm:submitForGrade'].disabled=true;473 }474 else{ // any subsequent click disable button & action475 if (document.forms[0].elements['takeAssessmentForm:quit'])476 document.forms[0].elements['takeAssessmentForm:quit'].disabled=true;477 }478}479var submitForGradeDisabled = 'false';480function disableSubmitForGrade(){481 if (submitForGradeDisabled === 'false'){482 submitForGradeDisabled = 'true';483 disableTOCFeedback();484 if (document.forms[0].elements['takeAssessmentForm:next'])485 document.forms[0].elements['takeAssessmentForm:next'].disabled=true;486 if (document.forms[0].elements['takeAssessmentForm:previous'])487 document.forms[0].elements['takeAssessmentForm:previous'].disabled=true;488 if (document.forms[0].elements['takeAssessmentForm:save'])489 document.forms[0].elements['takeAssessmentForm:save'].disabled=true;490 if (document.forms[0].elements['takeAssessmentForm:saveAndExit'])491 document.forms[0].elements['takeAssessmentForm:saveAndExit'].disabled=true;492 if (document.forms[0].elements['takeAssessmentForm:saveAndExit2'])493 document.forms[0].elements['takeAssessmentForm:saveAndExit2'].disabled=true;494 if (document.forms[0].elements['takeAssessmentForm:submitForm'])495 document.forms[0].elements['takeAssessmentForm:submitForm'].disabled=true;496 if (document.forms[0].elements['takeAssessmentForm:submitForm1'])497 document.forms[0].elements['takeAssessmentForm:submitForm1'].disabled=true;498 if (document.forms[0].elements['takeAssessmentForm:quit'])499 document.forms[0].elements['takeAssessmentForm:quit'].disabled=true;500 }501 else{ // any subsequent click disable button & action502 if (document.forms[0].elements['takeAssessmentForm:submitForGrade']) {503 document.forms[0].elements['takeAssessmentForm:submitForGrade'].disabled=true;504}505 }506}507function enableSubmitForGrade(){508 if (submitForGradeDisabled === 'true'){509 submitForGradeDisabled = 'false';510 if (document.forms[0].elements['takeAssessmentForm:next'])511 document.forms[0].elements['takeAssessmentForm:next'].disabled=false;512 if (document.forms[0].elements['takeAssessmentForm:previous'])513 document.forms[0].elements['takeAssessmentForm:previous'].disabled=false;514 if (document.forms[0].elements['takeAssessmentForm:saveAndExit'])515 document.forms[0].elements['takeAssessmentForm:saveAndExit'].disabled=false;516 if (document.forms[0].elements['takeAssessmentForm:saveAndExit2'])517 document.forms[0].elements['takeAssessmentForm:saveAndExit2'].disabled=false;518 if (document.forms[0].elements['takeAssessmentForm:submitForm'])519 document.forms[0].elements['takeAssessmentForm:submitForm'].disabled=false;520 if (document.forms[0].elements['takeAssessmentForm:submitForm1'])521 document.forms[0].elements['takeAssessmentForm:submitForm1'].disabled=false;522 if (document.forms[0].elements['takeAssessmentForm:quit'])523 document.forms[0].elements['takeAssessmentForm:quit'].disabled=false;524 if (document.forms[0].elements['takeAssessmentForm:submitForGrade'])525 document.forms[0].elements['takeAssessmentForm:submitForGrade'].disabled=false;526 }527}528function enableSave(){529 if (saveDisabled === 'true'){530 saveDisabled = 'false';531 disableTOCFeedback();532 if (document.forms[0].elements['takeAssessmentForm:next'])533 document.forms[0].elements['takeAssessmentForm:next'].disabled=false;534 if (document.forms[0].elements['takeAssessmentForm:previous'])535 document.forms[0].elements['takeAssessmentForm:previous'].disabled=false;536 if (document.forms[0].elements['takeAssessmentForm:quit'])537 document.forms[0].elements['takeAssessmentForm:quit'].disabled=false;538 if (document.forms[0].elements['takeAssessmentForm:saveAndExit2'])539 document.forms[0].elements['takeAssessmentForm:saveAndExit2'].disabled=false;540 if (document.forms[0].elements['takeAssessmentForm:submitForm'])541 document.forms[0].elements['takeAssessmentForm:submitForm'].disabled=false;542 if (document.forms[0].elements['takeAssessmentForm:submitForm1'])543 document.forms[0].elements['takeAssessmentForm:submitForm1'].disabled=false;544 if (document.forms[0].elements['takeAssessmentForm:submitForGrade'])545 document.forms[0].elements['takeAssessmentForm:submitForGrade'].disabled=false;546 }547 else{ // any subsequent click disable button & action548 if (document.forms[0].elements['takeAssessmentForm:saveAndExit'])549 document.forms[0].elements['takeAssessmentForm:saveAndExit'].disabled=false;550 }551}552var continueDisabled = 'false';553function disableContinue(){554 if (continueDisabled === 'false'){555 continueDisabled = 'true';556 if (document.forms[0].elements['saveForLater:returnToAssessment'])557 document.forms[0].elements['saveForLater:returnToAssessment'].disabled=true; }558 else{ // any subsequent click disable button & action559 if (document.forms[0].elements['saveForLater:continue'])560 document.forms[0].elements['saveForLater:continue'].disabled=true;561 }562}563var returnToAssessmentDisabled = 'false';564function disableReturnToAssessment(){565 if (returnToAssessmentDisabled === 'false'){566 returnToAssessmentDisabled = 'true';567 if (document.forms[0].elements['saveForLater:continue'])568 document.forms[0].elements['saveForLater:continue'].disabled=true;569 }570 else{ // any subsequent click disable button & action571 if (document.forms[0].elements['saveForLater:returnToAssessment'])572 document.forms[0].elements['saveForLater:returnToAssessment'].disabled=true;573 }574}575// show Processing for file upload questions 576// taking out of deliveryAssessment.jsp, so authoring can use it too. 577function showNotif(item, button,formName)578{579/*580 if (button !="noBlock")581 {582 eval("document." + formName + "." + button + ".disabled=true");583 }584*/585 if (item !== "noNotif") {586 var browserType;587 if (document.all) {browserType = "ie";}588 if (window.navigator.userAgent.toLowerCase().match("gecko")) {browserType= "gecko";}589 if (browserType === "gecko" )590 document.showItem = eval('document.getElementById(item)');591 else if (browserType === "ie")592 document.showItem = eval('document.all[item]');593 else594 document.showItem = eval('document.layers[item]');595 document.showItem.style.visibility = "visible";596 }597 for (var i=0;i<document.getElementsByTagName("input").length; i++)598 {599 if (document.getElementsByTagName("input").item(i).className == "disableme")600 {601 document.getElementsByTagName("input").item(i).disabled = "disabled";602 }603 }604}605function showNotif2(item, button,formName)606{607 alert('item: '+item);608 alert('button: '+button);609 alert('formname: '+formName);610 if (button !="noBlock")611 {612 eval("document." + formName + "." + button + ".disabled=true");613 }614 if (item !="noNotif")615 {616 var browserType;617 if (document.all) {browserType = "ie";}618 if (window.navigator.userAgent.toLowerCase().match("gecko")) {browserType= "gecko";}619 if (browserType == "gecko" )620 document.showItem = eval('document.getElementById(item)');621 else if (browserType == "ie")622 document.showItem = eval('document.all[item]');623 else624 document.showItem = eval('document.layers[item]');625 document.showItem.style.visibility = "visible";626 }627 for (var i=0;i<document.getElementsByTagName("input").length; i++)628 {629 if (document.getElementsByTagName("input").item(i).className == "disableme")630 {631 document.getElementsByTagName("input").item(i).disabled = "disabled";632 }633 }634}635function clearIfDefaultString(formField, defaultString) {636 if(formField.value == defaultString) {637 formField.value = "";638 }639}640function submitOnEnter(event, defaultButtonId) {641 var characterCode;642 if (event.which) {643 characterCode = event.which;644 } else if (event.keyCode) {645 characterCode = event.keyCode;646 }647 if (characterCode == 13) {648 event.returnValue = false;649 event.cancel = true;650 document.getElementById(defaultButtonId).click();651 return false;652 } else {653 return true;654 }655}656function show(obj) {657 document.getElementById(obj).style.display = '';658}659function hide(obj) {660 document.getElementById(obj).style.display = 'none';661}662function clickReloadLink(windowToGetFocus){663 664var newindex = 0;665for (i=0; i<document.links.length; i++) {666 if ( document.links[i].id.indexOf("hiddenReloadLink") >=0){667 newindex = i;668 break;669 }670}671document.links[newindex].onclick();672windowToGetFocus.focus();673return false;674}675/* Converts implicit form control labeling to explicit by676 * adding an unique id to form controls if they don't already677 * have one and then setting the corresponding label element's678 * for attribute to form control's id value. This explicit 679 * linkage is better supported by adaptive technologies.680 * See SAK-18851 for original.681 */682fixImplicitLabeling = function(){683 var idCounter = 0;684 $('label select,label input').each(function (idx, oInput) {685 if (!oInput.id) {686 idCounter++;687 $(oInput).attr('id', 'a11yAutoGenInputId' + idCounter.toString());688 }689 if (!$(oInput).parents('label').eq(0).attr('for')) {690 $(oInput).parents('label').eq(0).attr('for', $(oInput).attr('id'));691 }692 });693};...

Full Screen

Full Screen

tools_18-05-12.js

Source:tools_18-05-12.js Github

copy

Full Screen

1$(document).ready( function(){2 $("a.CatalogImages").click(function(){3 var src = $(this).attr("image");4 if ($.trim(src) == "") return false;5 $("#ImageLayout").empty();6 $("#ImageLayout").append( $("<IMG>").attr("src", src).click(function(){ $("#ImageLayout").hide(); }) );7 $("#ImageLayout").css({"left" : $(this).offset().left, "top" : $(this).offset().top} ).show();8 return false;9 });10 $("#ImageLayout").click(function(){ $(this).hide(); });11 $("#submit_basket_form").submit(function(){12 //alert($("input[name='payment']:checked", $("form#submit_basket_form")).val());13 //return false;14 //åñëè àâòîðèçîâàí, òî ñðàçó äåëàåì çàêàç15 if ( $("#register").val() == 1 )16 {17 $("input[name='submit_basket'][type='image']").attr("disabled", "true").fadeOut("fast");18 $.post('http://' + location.hostname + '/shop/basket/submit/', {19 submit_order : 1,20 dostavka : $("input[name='dostavka']:checked", $("form#submit_basket_form")).val(),21 company_dost : $("input[name='company_dost']:checked", $("form#submit_basket_form")).val(),22 payment : $("input[name='payment']:checked", $("form#submit_basket_form")).val(),23 company : $("input[name='company']", $("form#submit_basket_form")).val(),24 inn : $("input[name='inn']", $("form#submit_basket_form")).val(),25 kpp : $("input[name='kpp']", $("form#submit_basket_form")).val(),26 comment : $("textarea[name='comment']", $("form#submit_basket_form")).val()27 }, function(response) { location = 'http://' + location.hostname + '/shop/basket/final/'; } );28 29 }30 else31 //èíà÷å ðåãèì/ëîãèíèì32 {33 //àâòîðèçàöèÿ34 if ($("#question").attr("register") == 1)35 {36 37 //if (login_validate.form())38 {39 $.post('http://' + location.hostname + '/cabinet/login/', {40 submit_login : 1,41 login_email : $("input[name='login_email']", $("form#login_user_form")).val(),42 login_pass : $("input[name='login_pass']", $("form#login_user_form")).val()43 }, function(response){ 44 if (response != 1)45 {46 switch(response)47 {48 case "error1":49 $("#response_server").html("Íåïðàâèëüíûé ôîðìàò e-mail àäðåñà");50 break;51 case "error2":52 $("#response_server").html("Íåâåðíàÿ ïàðà ëîãèí/ïàðîëü");53 break;54 }55 }56 else57 {58 //$("#submit_basket_form").submit();59 $("input[name='submit_basket'][type='image']").attr("disabled", "true").fadeOut("fast");60 $.post('http://' + location.hostname + '/shop/basket/submit/', {61 submit_order : 1,62 dostavka : $("input[name='dostavka']:checked", $("form#submit_basket_form")).val(),63 company_dost : $("input[name='company_dost']:checked", $("form#submit_basket_form")).val(),64 payment : $("input[name='payment']:checked", $("form#submit_basket_form")).val(),65 company : $("input[name='company']", $("form#submit_basket_form")).val(),66 inn : $("input[name='inn']", $("form#submit_basket_form")).val(),67 kpp : $("input[name='kpp']", $("form#submit_basket_form")).val(),68 comment : $("textarea[name='comment']", $("form#submit_basket_form")).val()69 }, function(response) { location = 'http://' + location.hostname + '/shop/basket/final/'; } );70 return false;71 }72 } );73 }74 }75 else76 {77 //ðåãèñòðàöèÿ78 79 //if (register_validate.form())80 {81 82 $.post('http://' + location.hostname + '/cabinet/register/',{83 84 submit_user_register : 1,85 username : $("input[name='username']", $("form#register_user_form")).val(),86 useremail : $("input[name='useremail']", $("form#register_user_form")).val(),87 phone : $("input[name='phone']", $("form#register_user_form")).val(),88 address : $("input[name='address']", $("form#register_user_form")).val(),89 pass : $("input[name='pass']", $("form#register_user_form")).val()90 }, function(response){ 91 92 if (response != 1)93 {94 switch(response)95 {96 case "error1":97 $("#response_server").html("Íåïðàâèëüíûé ôîðìàò e-mail àäðåñà");98 break;99 case "error2":100 $("#response_server").html("Ïîëüçîâàòåëü ñ òàêèì ïî÷òîâûì àäðåñîì óæå ñóùåñòâóåò");101 break;102 }103 }104 else105 {106 $("input[name='submit_basket'][type='image']").attr("disabled", "true").fadeOut("fast");107 $.post('http://' + location.hostname + '/shop/basket/submit/', {108 submit_order : 1,109 dostavka : $("input[name='dostavka']:checked", $("form#submit_basket_form")).val(),110 company_dost : $("input[name='company_dost']:checked", $("form#submit_basket_form")).val(),111 payment : $("input[name='payment']:checked", $("form#submit_basket_form")).val(),112 company : $("input[name='company']", $("form#submit_basket_form")).val(),113 inn : $("input[name='inn']", $("form#submit_basket_form")).val(),114 kpp : $("input[name='kpp']", $("form#submit_basket_form")).val(),115 comment : $("textarea[name='comment']", $("form#submit_basket_form")).val()116 }, function(response) { location = 'http://' + location.hostname + '/shop/basket/final/'; } );117 118 }119 })120 }121 }122 123 }124 return false;125 });126 127 128 //ðåãèñòðàöèÿ/ëîãèí ïðè çàêàçå129 $("#register_login").click(function(){130 131 if ($("#question").attr("register") == 1)132 {133 if (login_validate.form())134 {135 $("form#login_user_form").submit();136 }137 }138 else139 {140 if (register_validate.form())141 {142 $("form#register_user_form").submit();143 }144 }145 146 });147 148 $("form#restore_password_form").submit(function(){149 return restore_validate.form();150 });151 var restore_validate = $("form#restore_password_form").validate(152 {153 154 errorPlacement: function(error, element) {155 error.insertAfter( element );156 },157 158 rules:159 {160 email : {required: true, email : true}161 },162 messages:163 {164 email: {165 required : "Ââåäèòå email",166 email : "Íåâåðíûé ôîðìàò email"167 }168 }169 }170 );171 172 173 174 var login_validate = $("form#login_user_form").validate(175 {176 177 errorPlacement: function(error, element) {178 error.insertAfter( element );179 },180 181 rules:182 {183 login_email : {required: true, email : true},184 login_pass : {required: true}185 },186 messages:187 {188 login_email: {189 required : "Ââåäèòå email",190 email : "Íåâåðíûé ôîðìàò email"191 },192 login_pass: {193 required : "Ââåäèòå ïàðîëü"194 }195 }196 }197 );198 199 var register_validate = $("form#register_user_form").validate(200 {201 202 errorPlacement: function(error, element) {203 error.insertAfter( element );204 },205 206 rules:207 {208 username : {required: true},209 phone : {required: true},210 useremail : {required: true, email:true},211 address : {required: true}212 //pass: {required: true}213 },214 messages:215 {216 username: {217 required : "Ââåäèòå èìÿ"218 },219 phone: {220 required : "Ââåäèòå òåëåôîí"221 },222 useremail: {223 required : "Ââåäèòå email",224 email : "Íåâåðíûé ôîðìàò email"225 },226 address: {227 required : "Ââåäèòå àäðåñ"228 }229 /*pass: {230 required : "Ââåäèòå ïàðîëü"231 }*/232 }233 }234 );235 236 237 238 var comment_validate = $("form#add_comment").validate(239 {240 241 errorPlacement: function(error, element) {242 error.insertAfter( element );243 },244 245 rules:246 {247 bvz : {required: true},248 tvfbk : {required: true, email : true},249 ntrcn : {required: true}250 },251 messages:252 {253 bvz: {254 required : "Ââåäèòå âàøå èìÿ"255 },256 257 tvfbk: {258 required : "Ââåäèòå email",259 email : "Íåâåðíûé ôîðìàò email"260 },261 262 ntrcn: {263 required : "Ââåäèòå êîììåíòàðèé"264 }265 266 }267 }268 );269 270 //ññûëêà ïîêàçàòü/ñêðûòü ôîðìó ðåãèñòðàöèè/ëîãèíà271 $("A#question").click(function(){272 if ($(this).attr("register") == 1)273 {274 $("#login_user").fadeOut("fast");275 $("#register_user").fadeIn("fast");276 $(this).html("Âû óæå çàðåãèñòðèðîâàííû ?");277 $(this).attr("register", "0");278 }279 else280 {281 $("#login_user").fadeIn("fast");282 $("#register_user").fadeOut("fast");283 $(this).html("Íå çàðåãèñòðèðîâàííû ?");284 $(this).attr("register", "1");285 }286 return false;287 });288 289 290 $("#repassword").click(function(){291 292 $("#repassword_user").css({"top" : $(this).offset().top, "left" : $(this).offset().left-100 })293 .fadeIn("fast");294 return false;295 });296 $("#repassword_close").click(function(){297 298 $("#repassword_user").fadeOut("fast");299 return false;300 });301 $("#repassword_form").submit(function(){302 if (validator_repassword.form())303 {304 var email = $("input[name='repassword_email']").val();305 $.post('http://' + location.hostname + '/cabinet/', {submit_restore : 1, email : email}, 306 function(response){307 if (response == 1)308 $("#repassword_msg").html("Íîâûé ïàðîëü âûñëàí íà âàø email");309 else310 $("#repassword_msg").html("Ïàðîëü íå âîññòàíîâëåí");311 });312 }313 return false;314 });315 316 317 var validator_repassword = $("FORM#repassword_form").validate(318 {319 errorPlacement: function(error, element) {320 error.insertAfter( element );321 },322 323 rules:324 {325 repassword_email : {required: true, email : true}326 },327 328 messages:329 {330 repassword_email: {331 required : "Ââåäèòå email",332 email : "Íåâåðíûé ôîðìàò"333 }334 }335 }336 );337 338 339 340 //ëåâîå ìåíþ, ÷òî-òî âðîäå àíèìàöèè341 $("A.lmenuf:not(.static)").click( function(){342 var submenu = $("DIV#subitem_" + $(this).attr("id"));343 if ($(submenu).css("display") != "block" )344 {345 $("DIV.submenu").fadeOut().animate({opacity:.5}, 100);346 $(submenu).animate({opacity:1},250).fadeIn("fast");347 }348 return false;349 } );350 351 352 //çàêàç ïðîäóêòà íà îòäåëüíîé ñòðàíèöå353 $("FORM#form_order_single").submit(function(){354 if (form_order_single_validate.form())355 {356 //ïîëó÷àåì îòâåò îò ñåðâåðà357 this.response = function(response){358 $("DIV#loading-layer").hide();359 var floor = response.split(";");360 361 if (parseInt(floor[0]) == 1001)362 {363 if (floor[1] > 0)364 alert("Âíèìàíèå!  íàëè÷èè îñòàëîñü òîëüêî " + floor[1] + " øò.");365 else366 alert("Òîâàð çàêîí÷èëñÿ íà ñêëàäå.");367 return false;368 }369 370 371 $("#basket_number").html(floor[0]);372 $("#basket_currency").html(floor[1]);373 };374 375 376 var product_id = $("input[name='product_id']", $(this)).val();377 var product_count = $("input[name='count']", $(this)).val();378 $("DIV#loading-layer").show();379 //êèäàåì çàïðîñ íà ñåðâåð380 $.post('http://' + location.hostname + '/shop/basket/add/', 381 {product_id : product_id, product_count : product_count}, 382 this.response );383 384 385 }386 return false;387 });388 389 390 391 var form_order_single_validate = $("FORM#form_order_single").validate(392 {393 394 errorPlacement: function(error, element) {395 error.insertAfter( element );396 },397 398 rules:399 {400 count : {required: true, number : true}401 },402 messages:403 {404 count: {405 required : "Ââåäèòå ÷èñëî",406 number : "Ââîäèòå òîëüêî ÷èñëà"407 }408 }409 }410 );411 412 413 //çàêàç èç ñïèñêà ïðîäóêòîâ â êàòåãîðèè414 $("input[name='add_order']").click(function(){415 416 this.response = function(response){417 $("DIV#loading-layer").hide();418 var floor = response.split(";");419 420 if (parseInt(floor[0]) == 1001)421 {422 if (floor[1] > 0)423 alert("Âíèìàíèå!  íàëè÷èè îñòàëîñü òîëüêî " + floor[1] + " øò.");424 else425 alert("Òîâàð çàêîí÷èëñÿ íà ñêëàäå.");426 return false;427 }428 429 $("#basket_number").html(floor[0]);430 $("#basket_currency").html(floor[1]);431 };432 433 434 var product_count = $("td input[type='text']", $(this).parent().parent()).val();435 var product_id = $("td input[type='text']", $(this).parent().parent()).attr("name");436 if (parseInt(product_count) > 0 && parseInt(product_id) > 0)437 {438 $("DIV#loading-layer").show();439 //êèäàåì çàïðîñ íà ñåðâåð440 $.post('http://' + location.hostname + '/shop/basket/add/', 441 {product_id : product_id, product_count : product_count}, 442 this.response );443 444 }445 return false;446 });447 448 var validator = $("FORM#RegisterForm").validate(449 {450 451 errorPlacement: function(error, element) {452 error.insertAfter( element );453 },454 455 rules:456 {457 email : {required: true, email : true, remote : 'http://' + location.hostname + '/shop/ajax/checkemail/'},458 tel : {required: true},459 name : {required: true},460 password : {required : true, minlength : 6},461 password_again : {equalTo : "#password"}462 },463 messages:464 {465 email: {466 required : "Ââåäèòå email",467 email : "Íåâåðíûé ôîðìàò",468 remote : "Òàêîé email óæå çàðåãèñòðèðîâàí"469 },470 tel: {471 required : "Ââåäèòå êîíòàêòíûé òåëåôîí"472 },473 name: {474 required : "Ââåäèòå âàøå èìÿ"475 },476 password : {477 required : "Ââåäèòå ïàðîëü",478 minlength : "Ìèíèìàëüíàÿ äëèíà ïàðîëÿ 4 ñèìâîëà"479 },480 password_again : "Ïàðîëè íå ñîâïàäàþò"481 482 }483 }484 );485 486 $("A#i_registered").click(function(){487 if ($("FORM#Registration").css('display') == 'block')488 {489 $("FORM#Registration").hide();490 $("FORM#Auth").show();491 $(this).html("ß íå çàðåãèñòðèðîâàí");492 }493 else494 {495 $("FORM#Auth").hide();496 $("FORM#Registration").show();497 $(this).html("ß óæå çàðåãèñòðèðîâàí");498 }499 return false;500 });501 502} );...

Full Screen

Full Screen

tools_02-2-02-12.js

Source:tools_02-2-02-12.js Github

copy

Full Screen

1$(document).ready( function(){2 $("a.CatalogImages").click(function(){3 var src = $(this).attr("image");4 if ($.trim(src) == "") return false;5 $("#ImageLayout").empty();6 $("#ImageLayout").append( $("<IMG>").attr("src", src).click(function(){ $("#ImageLayout").hide(); }) );7 $("#ImageLayout").css({"left" : $(this).offset().left, "top" : $(this).offset().top} ).show();8 return false;9 });10 $("#ImageLayout").click(function(){ $(this).hide(); });11 $("#submit_basket_form").submit(function(){12 //alert($("input[name='payment']:checked", $("form#submit_basket_form")).val());13 //return false;14 //åñëè àâòîðèçîâàí, òî ñðàçó äåëàåì çàêàç15 if ( $("#register").val() == 1 )16 {17 $("input[name='submit_basket'][type='image']").attr("disabled", "true").fadeOut("fast");18 $.post('http://' + location.hostname + '/shop/basket/submit/', {19 submit_order : 1,20 dostavka : $("input[name='dostavka']:checked", $("form#submit_basket_form")).val(),21 company_dost : $("input[name='company_dost']:checked", $("form#submit_basket_form")).val(),22 payment : $("input[name='payment']:checked", $("form#submit_basket_form")).val(),23 company : $("input[name='company']", $("form#submit_basket_form")).val(),24 inn : $("input[name='inn']", $("form#submit_basket_form")).val(),25 kpp : $("input[name='kpp']", $("form#submit_basket_form")).val(),26 comment : $("textarea[name='comment']", $("form#submit_basket_form")).val()27 }, function(response) { location = 'http://' + location.hostname + '/shop/basket/final/'; } );28 29 }30 else31 //èíà÷å ðåãèì/ëîãèíèì32 {33 //àâòîðèçàöèÿ34 if ($("#question").attr("register") == 1)35 {36 37 //if (login_validate.form())38 {39 $.post('http://' + location.hostname + '/cabinet/login/', {40 submit_login : 1,41 login_email : $("input[name='login_email']", $("form#login_user_form")).val(),42 login_pass : $("input[name='login_pass']", $("form#login_user_form")).val()43 }, function(response){ 44 if (response != 1)45 {46 switch(response)47 {48 case "error1":49 $("#response_server").html("Íåïðàâèëüíûé ôîðìàò e-mail àäðåñà");50 break;51 case "error2":52 $("#response_server").html("Íåâåðíàÿ ïàðà ëîãèí/ïàðîëü");53 break;54 }55 }56 else57 {58 //$("#submit_basket_form").submit();59 $("input[name='submit_basket'][type='image']").attr("disabled", "true").fadeOut("fast");60 $.post('http://' + location.hostname + '/shop/basket/submit/', {61 submit_order : 1,62 dostavka : $("input[name='dostavka']:checked", $("form#submit_basket_form")).val(),63 company_dost : $("input[name='company_dost']:checked", $("form#submit_basket_form")).val(),64 payment : $("input[name='payment']:checked", $("form#submit_basket_form")).val(),65 company : $("input[name='company']", $("form#submit_basket_form")).val(),66 inn : $("input[name='inn']", $("form#submit_basket_form")).val(),67 kpp : $("input[name='kpp']", $("form#submit_basket_form")).val(),68 comment : $("textarea[name='comment']", $("form#submit_basket_form")).val()69 }, function(response) { location = 'http://' + location.hostname + '/shop/basket/final/'; } );70 return false;71 }72 } );73 }74 }75 else76 {77 //ðåãèñòðàöèÿ78 79 //if (register_validate.form())80 {81 82 $.post('http://' + location.hostname + '/cabinet/register/',{83 84 submit_user_register : 1,85 username : $("input[name='username']", $("form#register_user_form")).val(),86 useremail : $("input[name='useremail']", $("form#register_user_form")).val(),87 phone : $("input[name='phone']", $("form#register_user_form")).val(),88 address : $("input[name='address']", $("form#register_user_form")).val(),89 pass : $("input[name='pass']", $("form#register_user_form")).val()90 }, function(response){ 91 92 if (response != 1)93 {94 switch(response)95 {96 case "error1":97 $("#response_server").html("Íåïðàâèëüíûé ôîðìàò e-mail àäðåñà");98 break;99 case "error2":100 $("#response_server").html("Ïîëüçîâàòåëü ñ òàêèì ïî÷òîâûì àäðåñîì óæå ñóùåñòâóåò");101 break;102 }103 }104 else105 {106 $("input[name='submit_basket'][type='image']").attr("disabled", "true").fadeOut("fast");107 $.post('http://' + location.hostname + '/shop/basket/submit/', {108 submit_order : 1,109 dostavka : $("input[name='dostavka']:checked", $("form#submit_basket_form")).val(),110 company_dost : $("input[name='company_dost']:checked", $("form#submit_basket_form")).val(),111 payment : $("input[name='payment']:checked", $("form#submit_basket_form")).val(),112 company : $("input[name='company']", $("form#submit_basket_form")).val(),113 inn : $("input[name='inn']", $("form#submit_basket_form")).val(),114 kpp : $("input[name='kpp']", $("form#submit_basket_form")).val(),115 comment : $("textarea[name='comment']", $("form#submit_basket_form")).val()116 }, function(response) { location = 'http://' + location.hostname + '/shop/basket/final/'; } );117 118 }119 })120 }121 }122 123 }124 return false;125 });126 127 128 //ðåãèñòðàöèÿ/ëîãèí ïðè çàêàçå129 $("#register_login").click(function(){130 131 if ($("#question").attr("register") == 1)132 {133 if (login_validate.form())134 {135 $("form#login_user_form").submit();136 }137 }138 else139 {140 if (register_validate.form())141 {142 $("form#register_user_form").submit();143 }144 }145 146 });147 148 $("form#restore_password_form").submit(function(){149 return restore_validate.form();150 });151 var restore_validate = $("form#restore_password_form").validate(152 {153 154 errorPlacement: function(error, element) {155 error.insertAfter( element );156 },157 158 rules:159 {160 email : {required: true, email : true}161 },162 messages:163 {164 email: {165 required : "Ââåäèòå email",166 email : "Íåâåðíûé ôîðìàò email"167 }168 }169 }170 );171 172 173 174 var login_validate = $("form#login_user_form").validate(175 {176 177 errorPlacement: function(error, element) {178 error.insertAfter( element );179 },180 181 rules:182 {183 login_email : {required: true, email : true},184 login_pass : {required: true}185 },186 messages:187 {188 login_email: {189 required : "Ââåäèòå email",190 email : "Íåâåðíûé ôîðìàò email"191 },192 login_pass: {193 required : "Ââåäèòå ïàðîëü"194 }195 }196 }197 );198 199 var register_validate = $("form#register_user_form").validate(200 {201 202 errorPlacement: function(error, element) {203 error.insertAfter( element );204 },205 206 rules:207 {208 username : {required: true},209 phone : {required: true},210 useremail : {required: true, email:true},211 address : {required: true}212 //pass: {required: true}213 },214 messages:215 {216 username: {217 required : "Ââåäèòå èìÿ"218 },219 phone: {220 required : "Ââåäèòå òåëåôîí"221 },222 useremail: {223 required : "Ââåäèòå email",224 email : "Íåâåðíûé ôîðìàò email"225 },226 address: {227 required : "Ââåäèòå àäðåñ"228 }229 /*pass: {230 required : "Ââåäèòå ïàðîëü"231 }*/232 }233 }234 );235 236 237 238 var comment_validate = $("form#add_comment").validate(239 {240 241 errorPlacement: function(error, element) {242 error.insertAfter( element );243 },244 245 rules:246 {247 bvz : {required: true},248 tvfbk : {required: true, email : true},249 ntrcn : {required: true}250 },251 messages:252 {253 bvz: {254 required : "Ââåäèòå âàøå èìÿ"255 },256 257 tvfbk: {258 required : "Ââåäèòå email",259 email : "Íåâåðíûé ôîðìàò email"260 },261 262 ntrcn: {263 required : "Ââåäèòå êîììåíòàðèé"264 }265 266 }267 }268 );269 270 //ññûëêà ïîêàçàòü/ñêðûòü ôîðìó ðåãèñòðàöèè/ëîãèíà271 $("A#question").click(function(){272 if ($(this).attr("register") == 1)273 {274 $("#login_user").fadeOut("fast");275 $("#register_user").fadeIn("fast");276 $(this).html("Âû óæå çàðåãèñòðèðîâàííû ?");277 $(this).attr("register", "0");278 }279 else280 {281 $("#login_user").fadeIn("fast");282 $("#register_user").fadeOut("fast");283 $(this).html("Íå çàðåãèñòðèðîâàííû ?");284 $(this).attr("register", "1");285 }286 return false;287 });288 289 290 $("#repassword").click(function(){291 292 $("#repassword_user").css({"top" : $(this).offset().top, "left" : $(this).offset().left-100 })293 .fadeIn("fast");294 return false;295 });296 $("#repassword_close").click(function(){297 298 $("#repassword_user").fadeOut("fast");299 return false;300 });301 $("#repassword_form").submit(function(){302 if (validator_repassword.form())303 {304 var email = $("input[name='repassword_email']").val();305 $.post('http://' + location.hostname + '/cabinet/', {submit_restore : 1, email : email}, 306 function(response){307 if (response == 1)308 $("#repassword_msg").html("Íîâûé ïàðîëü âûñëàí íà âàø email");309 else310 $("#repassword_msg").html("Ïàðîëü íå âîññòàíîâëåí");311 });312 }313 return false;314 });315 316 317 var validator_repassword = $("FORM#repassword_form").validate(318 {319 errorPlacement: function(error, element) {320 error.insertAfter( element );321 },322 323 rules:324 {325 repassword_email : {required: true, email : true}326 },327 328 messages:329 {330 repassword_email: {331 required : "Ââåäèòå email",332 email : "Íåâåðíûé ôîðìàò"333 }334 }335 }336 );337 338 339 340 //ëåâîå ìåíþ, ÷òî-òî âðîäå àíèìàöèè341 $("A.lmenuf:not(.static)").click( function(){342 var submenu = $("DIV#subitem_" + $(this).attr("id"));343 if ($(submenu).css("display") != "block" )344 {345 $("DIV.submenu").fadeOut().animate({opacity:.5}, 100);346 $(submenu).animate({opacity:1},250).fadeIn("fast");347 }348 return false;349 } );350 351 352 //çàêàç ïðîäóêòà íà îòäåëüíîé ñòðàíèöå353 $("FORM#form_order_single").submit(function(){354 if (form_order_single_validate.form())355 {356 //ïîëó÷àåì îòâåò îò ñåðâåðà357 this.response = function(response){358 $("DIV#loading-layer").hide();359 var floor = response.split(";");360 361 if (parseInt(floor[0]) == 1001)362 {363 if (floor[1] > 0)364 alert("Âíèìàíèå!  íàëè÷èè îñòàëîñü òîëüêî " + floor[1] + " øò.");365 else366 alert("Òîâàð çàêîí÷èëñÿ íà ñêëàäå.");367 return false;368 }369 370 371 $("#basket_number").html(floor[0]);372 $("#basket_currency").html(floor[1]);373 };374 375 376 var product_id = $("input[name='product_id']", $(this)).val();377 var product_count = $("input[name='count']", $(this)).val();378 $("DIV#loading-layer").show();379 //êèäàåì çàïðîñ íà ñåðâåð380 $.post('http://' + location.hostname + '/shop/basket/add/', 381 {product_id : product_id, product_count : product_count}, 382 this.response );383 384 385 }386 return false;387 });388 389 390 391 var form_order_single_validate = $("FORM#form_order_single").validate(392 {393 394 errorPlacement: function(error, element) {395 error.insertAfter( element );396 },397 398 rules:399 {400 count : {required: true, number : true}401 },402 messages:403 {404 count: {405 required : "Ââåäèòå ÷èñëî",406 number : "Ââîäèòå òîëüêî ÷èñëà"407 }408 }409 }410 );411 412 413 //çàêàç èç ñïèñêà ïðîäóêòîâ â êàòåãîðèè414 $("input[name='add_order']").click(function(){415 416 this.response = function(response){417 $("DIV#loading-layer").hide();418 var floor = response.split(";");419 420 if (parseInt(floor[0]) == 1001)421 {422 if (floor[1] > 0)423 alert("Âíèìàíèå!  íàëè÷èè îñòàëîñü òîëüêî " + floor[1] + " øò.");424 else425 alert("Òîâàð çàêîí÷èëñÿ íà ñêëàäå.");426 return false;427 }428 429 $("#basket_number").html(floor[0]);430 $("#basket_currency").html(floor[1]);431 };432 433 434 var product_count = $("td input[type='text']", $(this).parent().parent()).val();435 var product_id = $("td input[type='text']", $(this).parent().parent()).attr("name");436 if (parseInt(product_count) > 0 && parseInt(product_id) > 0)437 {438 $("DIV#loading-layer").show();439 //êèäàåì çàïðîñ íà ñåðâåð440 $.post('http://' + location.hostname + '/shop/basket/add/', 441 {product_id : product_id, product_count : product_count}, 442 this.response );443 444 }445 return false;446 });447 448 var validator = $("FORM#RegisterForm").validate(449 {450 451 errorPlacement: function(error, element) {452 error.insertAfter( element );453 },454 455 rules:456 {457 email : {required: true, email : true, remote : 'http://' + location.hostname + '/shop/ajax/checkemail/'},458 tel : {required: true},459 name : {required: true},460 password : {required : true, minlength : 6},461 password_again : {equalTo : "#password"}462 },463 messages:464 {465 email: {466 required : "Ââåäèòå email",467 email : "Íåâåðíûé ôîðìàò",468 remote : "Òàêîé email óæå çàðåãèñòðèðîâàí"469 },470 tel: {471 required : "Ââåäèòå êîíòàêòíûé òåëåôîí"472 },473 name: {474 required : "Ââåäèòå âàøå èìÿ"475 },476 password : {477 required : "Ââåäèòå ïàðîëü",478 minlength : "Ìèíèìàëüíàÿ äëèíà ïàðîëÿ 4 ñèìâîëà"479 },480 password_again : "Ïàðîëè íå ñîâïàäàþò"481 482 }483 }484 );485 486 $("A#i_registered").click(function(){487 if ($("FORM#Registration").css('display') == 'block')488 {489 $("FORM#Registration").hide();490 $("FORM#Auth").show();491 $(this).html("ß íå çàðåãèñòðèðîâàí");492 }493 else494 {495 $("FORM#Auth").hide();496 $("FORM#Registration").show();497 $(this).html("ß óæå çàðåãèñòðèðîâàí");498 }499 return false;500 });501 502} );...

Full Screen

Full Screen

tools_02-02-12.js

Source:tools_02-02-12.js Github

copy

Full Screen

1$(document).ready( function(){2 $("a.CatalogImages").click(function(){3 var src = $(this).attr("image");4 if ($.trim(src) == "") return false;5 $("#ImageLayout").empty();6 $("#ImageLayout").append( $("<IMG>").attr("src", src).click(function(){ $("#ImageLayout").hide(); }) );7 $("#ImageLayout").css({"left" : $(this).offset().left, "top" : $(this).offset().top} ).show();8 return false;9 });10 $("#ImageLayout").click(function(){ $(this).hide(); });11 $("#submit_basket_form").submit(function(){12 //alert($("input[name='payment']:checked", $("form#submit_basket_form")).val());13 //return false;14 //åñëè àâòîðèçîâàí, òî ñðàçó äåëàåì çàêàç15 if ( $("#register").val() == 1 )16 {17 $("input[name='submit_basket'][type='image']").attr("disabled", "true").fadeOut("fast");18 $.post('http://' + location.hostname + '/shop/basket/submit/', {19 submit_order : 1,20 dostavka : $("input[name='dostavka']:checked", $("form#submit_basket_form")).val(),21 company_dost : $("input[name='company_dost']:checked", $("form#submit_basket_form")).val(),22 payment : $("input[name='payment']:checked", $("form#submit_basket_form")).val(),23 company : $("input[name='company']", $("form#submit_basket_form")).val(),24 inn : $("input[name='inn']", $("form#submit_basket_form")).val(),25 kpp : $("input[name='kpp']", $("form#submit_basket_form")).val(),26 comment : $("textarea[name='comment']", $("form#submit_basket_form")).val()27 }, function(response) { location = 'http://' + location.hostname + '/shop/basket/final/'; } );28 29 }30 else31 //èíà÷å ðåãèì/ëîãèíèì32 {33 //àâòîðèçàöèÿ34 if ($("#question").attr("register") == 1)35 {36 37 //if (login_validate.form())38 {39 $.post('http://' + location.hostname + '/cabinet/login/', {40 submit_login : 1,41 login_email : $("input[name='login_email']", $("form#login_user_form")).val(),42 login_pass : $("input[name='login_pass']", $("form#login_user_form")).val()43 }, function(response){ 44 if (response != 1)45 {46 switch(response)47 {48 case "error1":49 $("#response_server").html("Íåïðàâèëüíûé ôîðìàò e-mail àäðåñà");50 break;51 case "error2":52 $("#response_server").html("Íåâåðíàÿ ïàðà ëîãèí/ïàðîëü");53 break;54 }55 }56 else57 {58 //$("#submit_basket_form").submit();59 $("input[name='submit_basket'][type='image']").attr("disabled", "true").fadeOut("fast");60 $.post('http://' + location.hostname + '/shop/basket/submit/', {61 submit_order : 1,62 dostavka : $("input[name='dostavka']:checked", $("form#submit_basket_form")).val(),63 company_dost : $("input[name='company_dost']:checked", $("form#submit_basket_form")).val(),64 payment : $("input[name='payment']:checked", $("form#submit_basket_form")).val(),65 company : $("input[name='company']", $("form#submit_basket_form")).val(),66 inn : $("input[name='inn']", $("form#submit_basket_form")).val(),67 kpp : $("input[name='kpp']", $("form#submit_basket_form")).val(),68 comment : $("textarea[name='comment']", $("form#submit_basket_form")).val()69 }, function(response) { location = 'http://' + location.hostname + '/shop/basket/final/'; } );70 return false;71 }72 } );73 }74 }75 else76 {77 //ðåãèñòðàöèÿ78 79 //if (register_validate.form())80 {81 82 $.post('http://' + location.hostname + '/cabinet/register/',{83 84 submit_user_register : 1,85 username : $("input[name='username']", $("form#register_user_form")).val(),86 useremail : $("input[name='useremail']", $("form#register_user_form")).val(),87 phone : $("input[name='phone']", $("form#register_user_form")).val(),88 address : $("input[name='address']", $("form#register_user_form")).val(),89 pass : $("input[name='pass']", $("form#register_user_form")).val()90 }, function(response){ 91 92 if (response != 1)93 {94 switch(response)95 {96 case "error1":97 $("#response_server").html("Íåïðàâèëüíûé ôîðìàò e-mail àäðåñà");98 break;99 case "error2":100 $("#response_server").html("Ïîëüçîâàòåëü ñ òàêèì ïî÷òîâûì àäðåñîì óæå ñóùåñòâóåò");101 break;102 }103 }104 else105 {106 $("input[name='submit_basket'][type='image']").attr("disabled", "true").fadeOut("fast");107 $.post('http://' + location.hostname + '/shop/basket/submit/', {108 submit_order : 1,109 dostavka : $("input[name='dostavka']:checked", $("form#submit_basket_form")).val(),110 company_dost : $("input[name='company_dost']:checked", $("form#submit_basket_form")).val(),111 payment : $("input[name='payment']:checked", $("form#submit_basket_form")).val(),112 company : $("input[name='company']", $("form#submit_basket_form")).val(),113 inn : $("input[name='inn']", $("form#submit_basket_form")).val(),114 kpp : $("input[name='kpp']", $("form#submit_basket_form")).val(),115 comment : $("textarea[name='comment']", $("form#submit_basket_form")).val()116 }, function(response) { location = 'http://' + location.hostname + '/shop/basket/final/'; } );117 118 }119 })120 }121 }122 123 }124 return false;125 });126 127 128 //ðåãèñòðàöèÿ/ëîãèí ïðè çàêàçå129 $("#register_login").click(function(){130 131 if ($("#question").attr("register") == 1)132 {133 if (login_validate.form())134 {135 $("form#login_user_form").submit();136 }137 }138 else139 {140 if (register_validate.form())141 {142 $("form#register_user_form").submit();143 }144 }145 146 });147 148 $("form#restore_password_form").submit(function(){149 return restore_validate.form();150 });151 var restore_validate = $("form#restore_password_form").validate(152 {153 154 errorPlacement: function(error, element) {155 error.insertAfter( element );156 },157 158 rules:159 {160 email : {required: true, email : true}161 },162 messages:163 {164 email: {165 required : "Ââåäèòå email",166 email : "Íåâåðíûé ôîðìàò email"167 }168 }169 }170 );171 172 173 174 var login_validate = $("form#login_user_form").validate(175 {176 177 errorPlacement: function(error, element) {178 error.insertAfter( element );179 },180 181 rules:182 {183 login_email : {required: true, email : true},184 login_pass : {required: true}185 },186 messages:187 {188 login_email: {189 required : "Ââåäèòå email",190 email : "Íåâåðíûé ôîðìàò email"191 },192 login_pass: {193 required : "Ââåäèòå ïàðîëü"194 }195 }196 }197 );198 199 var register_validate = $("form#register_user_form").validate(200 {201 202 errorPlacement: function(error, element) {203 error.insertAfter( element );204 },205 206 rules:207 {208 username : {required: true},209 phone : {required: true},210 useremail : {required: true, email:true},211 address : {required: true}212 //pass: {required: true}213 },214 messages:215 {216 username: {217 required : "Ââåäèòå èìÿ"218 },219 phone: {220 required : "Ââåäèòå òåëåôîí"221 },222 useremail: {223 required : "Ââåäèòå email",224 email : "Íåâåðíûé ôîðìàò email"225 },226 address: {227 required : "Ââåäèòå àäðåñ"228 }229 /*pass: {230 required : "Ââåäèòå ïàðîëü"231 }*/232 }233 }234 );235 236 237 238 var comment_validate = $("form#add_comment").validate(239 {240 241 errorPlacement: function(error, element) {242 error.insertAfter( element );243 },244 245 rules:246 {247 bvz : {required: true},248 tvfbk : {required: true, email : true},249 ntrcn : {required: true}250 },251 messages:252 {253 bvz: {254 required : "Ââåäèòå âàøå èìÿ"255 },256 257 tvfbk: {258 required : "Ââåäèòå email",259 email : "Íåâåðíûé ôîðìàò email"260 },261 262 ntrcn: {263 required : "Ââåäèòå êîììåíòàðèé"264 }265 266 }267 }268 );269 270 //ññûëêà ïîêàçàòü/ñêðûòü ôîðìó ðåãèñòðàöèè/ëîãèíà271 $("A#question").click(function(){272 if ($(this).attr("register") == 1)273 {274 $("#login_user").fadeOut("fast");275 $("#register_user").fadeIn("fast");276 $(this).html("Âû óæå çàðåãèñòðèðîâàííû ?");277 $(this).attr("register", "0");278 }279 else280 {281 $("#login_user").fadeIn("fast");282 $("#register_user").fadeOut("fast");283 $(this).html("Íå çàðåãèñòðèðîâàííû ?");284 $(this).attr("register", "1");285 }286 return false;287 });288 289 290 $("#repassword").click(function(){291 292 $("#repassword_user").css({"top" : $(this).offset().top, "left" : $(this).offset().left-100 })293 .fadeIn("fast");294 return false;295 });296 $("#repassword_close").click(function(){297 298 $("#repassword_user").fadeOut("fast");299 return false;300 });301 $("#repassword_form").submit(function(){302 if (validator_repassword.form())303 {304 var email = $("input[name='repassword_email']").val();305 $.post('http://' + location.hostname + '/cabinet/', {submit_restore : 1, email : email}, 306 function(response){307 if (response == 1)308 $("#repassword_msg").html("Íîâûé ïàðîëü âûñëàí íà âàø email");309 else310 $("#repassword_msg").html("Ïàðîëü íå âîññòàíîâëåí");311 });312 }313 return false;314 });315 316 317 var validator_repassword = $("FORM#repassword_form").validate(318 {319 errorPlacement: function(error, element) {320 error.insertAfter( element );321 },322 323 rules:324 {325 repassword_email : {required: true, email : true}326 },327 328 messages:329 {330 repassword_email: {331 required : "Ââåäèòå email",332 email : "Íåâåðíûé ôîðìàò"333 }334 }335 }336 );337 338 339 340 //ëåâîå ìåíþ, ÷òî-òî âðîäå àíèìàöèè341 $("A.lmenuf:not(.static)").click( function(){342 var submenu = $("DIV#subitem_" + $(this).attr("id"));343 if ($(submenu).css("display") != "block" )344 {345 $("DIV.submenu").fadeOut().animate({opacity:.5}, 100);346 $(submenu).animate({opacity:1},250).fadeIn("fast");347 }348 return false;349 } );350 351 352 //çàêàç ïðîäóêòà íà îòäåëüíîé ñòðàíèöå353 $("FORM#form_order_single").submit(function(){354 if (form_order_single_validate.form())355 {356 //ïîëó÷àåì îòâåò îò ñåðâåðà357 this.response = function(response){358 $("DIV#loading-layer").hide();359 var floor = response.split(";");360 361 if (floor[0] == "error_count")362 {363 if (floor[1] > 0)364 alert("Âíèìàíèå!  íàëè÷èè îñòàëîñü òîëüêî " + floor[1] + " øò.");365 else366 alert("Òîâàð çàêîí÷èëñÿ íà ñêëàäå.");367 return false;368 }369 370 371 $("#basket_number").html(floor[0]);372 $("#basket_currency").html(floor[1]);373 };374 375 376 var product_id = $("input[name='product_id']", $(this)).val();377 var product_count = $("input[name='count']", $(this)).val();378 $("DIV#loading-layer").show();379 //êèäàåì çàïðîñ íà ñåðâåð380 $.post('http://' + location.hostname + '/shop/basket/add/', 381 {product_id : product_id, product_count : product_count}, 382 this.response );383 384 385 }386 return false;387 });388 389 390 391 var form_order_single_validate = $("FORM#form_order_single").validate(392 {393 394 errorPlacement: function(error, element) {395 error.insertAfter( element );396 },397 398 rules:399 {400 count : {required: true, number : true}401 },402 messages:403 {404 count: {405 required : "Ââåäèòå ÷èñëî",406 number : "Ââîäèòå òîëüêî ÷èñëà"407 }408 }409 }410 );411 412 413 //çàêàç èç ñïèñêà ïðîäóêòîâ â êàòåãîðèè414 $("input[name='add_order']").click(function(){415 416 this.response = function(response){417 $("DIV#loading-layer").hide();418 var floor = response.split(";");419 420 if (floor[0] == "error_count")421 {422 if (floor[1] > 0)423 alert("Âíèìàíèå!  íàëè÷èè îñòàëîñü òîëüêî " + floor[1] + " øò.");424 else425 alert("Òîâàð çàêîí÷èëñÿ íà ñêëàäå.");426 return false;427 }428 429 $("#basket_number").html(floor[0]);430 $("#basket_currency").html(floor[1]);431 };432 433 434 var product_count = $("td input[type='text']", $(this).parent().parent()).val();435 var product_id = $("td input[type='text']", $(this).parent().parent()).attr("name");436 if (parseInt(product_count) > 0 && parseInt(product_id) > 0)437 {438 $("DIV#loading-layer").show();439 //êèäàåì çàïðîñ íà ñåðâåð440 $.post('http://' + location.hostname + '/shop/basket/add/', 441 {product_id : product_id, product_count : product_count}, 442 this.response );443 444 }445 return false;446 });447 448 var validator = $("FORM#RegisterForm").validate(449 {450 451 errorPlacement: function(error, element) {452 error.insertAfter( element );453 },454 455 rules:456 {457 email : {required: true, email : true, remote : 'http://' + location.hostname + '/shop/ajax/checkemail/'},458 tel : {required: true},459 name : {required: true},460 password : {required : true, minlength : 6},461 password_again : {equalTo : "#password"}462 },463 messages:464 {465 email: {466 required : "Ââåäèòå email",467 email : "Íåâåðíûé ôîðìàò",468 remote : "Òàêîé email óæå çàðåãèñòðèðîâàí"469 },470 tel: {471 required : "Ââåäèòå êîíòàêòíûé òåëåôîí"472 },473 name: {474 required : "Ââåäèòå âàøå èìÿ"475 },476 password : {477 required : "Ââåäèòå ïàðîëü",478 minlength : "Ìèíèìàëüíàÿ äëèíà ïàðîëÿ 4 ñèìâîëà"479 },480 password_again : "Ïàðîëè íå ñîâïàäàþò"481 482 }483 }484 );485 486 $("A#i_registered").click(function(){487 if ($("FORM#Registration").css('display') == 'block')488 {489 $("FORM#Registration").hide();490 $("FORM#Auth").show();491 $(this).html("ß íå çàðåãèñòðèðîâàí");492 }493 else494 {495 $("FORM#Auth").hide();496 $("FORM#Registration").show();497 $(this).html("ß óæå çàðåãèñòðèðîâàí");498 }499 return false;500 });501 502} );...

Full Screen

Full Screen

tools_20-01-12.js

Source:tools_20-01-12.js Github

copy

Full Screen

1$(document).ready( function(){2 $("a.CatalogImages").click(function(){3 var src = $(this).attr("image");4 if ($.trim(src) == "") return false;5 $("#ImageLayout").empty();6 $("#ImageLayout").append( $("<IMG>").attr("src", src).click(function(){ $("#ImageLayout").hide(); }) );7 $("#ImageLayout").css({"left" : $(this).offset().left, "top" : $(this).offset().top} ).show();8 return false;9 });10 $("#ImageLayout").click(function(){ $(this).hide(); });11 $("#submit_basket_form").submit(function(){12 //alert($("input[name='payment']:checked", $("form#submit_basket_form")).val());13 //return false;14 //åñëè àâòîðèçîâàí, òî ñðàçó äåëàåì çàêàç15 if ( $("#register").val() == 1 )16 {17 $("input[name='submit_basket'][type='image']").attr("disabled", "true").fadeOut("fast");18 $.post('http://' + location.hostname + '/shop/basket/submit/', {19 submit_order : 1,20 dostavka : $("input[name='dostavka']:checked", $("form#submit_basket_form")).val(),21 company_dost : $("input[name='company_dost']:checked", $("form#submit_basket_form")).val(),22 payment : $("input[name='payment']:checked", $("form#submit_basket_form")).val(),23 company : $("input[name='company']", $("form#submit_basket_form")).val(),24 inn : $("input[name='inn']", $("form#submit_basket_form")).val(),25 kpp : $("input[name='kpp']", $("form#submit_basket_form")).val(),26 comment : $("textarea[name='comment']", $("form#submit_basket_form")).val()27 }, function(response) { location = 'http://' + location.hostname + '/shop/basket/final/'; } );28 29 }30 else31 //èíà÷å ðåãèì/ëîãèíèì32 {33 //àâòîðèçàöèÿ34 if ($("#question").attr("register") == 1)35 {36 37 //if (login_validate.form())38 {39 $.post('http://' + location.hostname + '/cabinet/login/', {40 submit_login : 1,41 login_email : $("input[name='login_email']", $("form#login_user_form")).val(),42 login_pass : $("input[name='login_pass']", $("form#login_user_form")).val()43 }, function(response){ 44 if (response != 1)45 {46 switch(response)47 {48 case "error1":49 $("#response_server").html("Íåïðàâèëüíûé ôîðìàò e-mail àäðåñà");50 break;51 case "error2":52 $("#response_server").html("Íåâåðíàÿ ïàðà ëîãèí/ïàðîëü");53 break;54 }55 }56 else57 {58 //$("#submit_basket_form").submit();59 $("input[name='submit_basket'][type='image']").attr("disabled", "true").fadeOut("fast");60 $.post('http://' + location.hostname + '/shop/basket/submit/', {61 submit_order : 1,62 dostavka : $("input[name='dostavka']:checked", $("form#submit_basket_form")).val(),63 company_dost : $("input[name='company_dost']:checked", $("form#submit_basket_form")).val(),64 payment : $("input[name='payment']:checked", $("form#submit_basket_form")).val(),65 company : $("input[name='company']", $("form#submit_basket_form")).val(),66 inn : $("input[name='inn']", $("form#submit_basket_form")).val(),67 kpp : $("input[name='kpp']", $("form#submit_basket_form")).val(),68 comment : $("textarea[name='comment']", $("form#submit_basket_form")).val()69 }, function(response) { location = 'http://' + location.hostname + '/shop/basket/final/'; } );70 return false;71 }72 } );73 }74 }75 else76 {77 //ðåãèñòðàöèÿ78 79 //if (register_validate.form())80 {81 82 $.post('http://' + location.hostname + '/cabinet/register/',{83 84 submit_user_register : 1,85 username : $("input[name='username']", $("form#register_user_form")).val(),86 useremail : $("input[name='useremail']", $("form#register_user_form")).val(),87 phone : $("input[name='phone']", $("form#register_user_form")).val(),88 address : $("input[name='address']", $("form#register_user_form")).val(),89 pass : $("input[name='pass']", $("form#register_user_form")).val()90 }, function(response){ 91 92 if (response != 1)93 {94 switch(response)95 {96 case "error1":97 $("#response_server").html("Íåïðàâèëüíûé ôîðìàò e-mail àäðåñà");98 break;99 case "error2":100 $("#response_server").html("Ïîëüçîâàòåëü ñ òàêèì ïî÷òîâûì àäðåñîì óæå ñóùåñòâóåò");101 break;102 }103 }104 else105 {106 $("input[name='submit_basket'][type='image']").attr("disabled", "true").fadeOut("fast");107 $.post('http://' + location.hostname + '/shop/basket/submit/', {108 submit_order : 1,109 dostavka : $("input[name='dostavka']:checked", $("form#submit_basket_form")).val(),110 company_dost : $("input[name='company_dost']:checked", $("form#submit_basket_form")).val(),111 payment : $("input[name='payment']:checked", $("form#submit_basket_form")).val(),112 company : $("input[name='company']", $("form#submit_basket_form")).val(),113 inn : $("input[name='inn']", $("form#submit_basket_form")).val(),114 kpp : $("input[name='kpp']", $("form#submit_basket_form")).val(),115 comment : $("textarea[name='comment']", $("form#submit_basket_form")).val()116 }, function(response) { location = 'http://' + location.hostname + '/shop/basket/final/'; } );117 118 }119 })120 }121 }122 123 }124 return false;125 });126 127 128 //ðåãèñòðàöèÿ/ëîãèí ïðè çàêàçå129 $("#register_login").click(function(){130 131 if ($("#question").attr("register") == 1)132 {133 if (login_validate.form())134 {135 $("form#login_user_form").submit();136 }137 }138 else139 {140 if (register_validate.form())141 {142 $("form#register_user_form").submit();143 }144 }145 146 });147 148 $("form#restore_password_form").submit(function(){149 return restore_validate.form();150 });151 var restore_validate = $("form#restore_password_form").validate(152 {153 154 errorPlacement: function(error, element) {155 error.insertAfter( element );156 },157 158 rules:159 {160 email : {required: true, email : true}161 },162 messages:163 {164 email: {165 required : "Ââåäèòå email",166 email : "Íåâåðíûé ôîðìàò email"167 }168 }169 }170 );171 172 173 174 var login_validate = $("form#login_user_form").validate(175 {176 177 errorPlacement: function(error, element) {178 error.insertAfter( element );179 },180 181 rules:182 {183 login_email : {required: true, email : true},184 login_pass : {required: true}185 },186 messages:187 {188 login_email: {189 required : "Ââåäèòå email",190 email : "Íåâåðíûé ôîðìàò email"191 },192 login_pass: {193 required : "Ââåäèòå ïàðîëü"194 }195 }196 }197 );198 199 var register_validate = $("form#register_user_form").validate(200 {201 202 errorPlacement: function(error, element) {203 error.insertAfter( element );204 },205 206 rules:207 {208 username : {required: true},209 phone : {required: true},210 useremail : {required: true, email:true},211 address : {required: true}212 //pass: {required: true}213 },214 messages:215 {216 username: {217 required : "Ââåäèòå èìÿ"218 },219 phone: {220 required : "Ââåäèòå òåëåôîí"221 },222 useremail: {223 required : "Ââåäèòå email",224 email : "Íåâåðíûé ôîðìàò email"225 },226 address: {227 required : "Ââåäèòå àäðåñ"228 }229 /*pass: {230 required : "Ââåäèòå ïàðîëü"231 }*/232 }233 }234 );235 236 237 238 var comment_validate = $("form#add_comment").validate(239 {240 241 errorPlacement: function(error, element) {242 error.insertAfter( element );243 },244 245 rules:246 {247 bvz : {required: true},248 tvfbk : {required: true, email : true},249 ntrcn : {required: true}250 },251 messages:252 {253 bvz: {254 required : "Ââåäèòå âàøå èìÿ"255 },256 257 tvfbk: {258 required : "Ââåäèòå email",259 email : "Íåâåðíûé ôîðìàò email"260 },261 262 ntrcn: {263 required : "Ââåäèòå êîììåíòàðèé"264 }265 266 }267 }268 );269 270 //ññûëêà ïîêàçàòü/ñêðûòü ôîðìó ðåãèñòðàöèè/ëîãèíà271 $("A#question").click(function(){272 if ($(this).attr("register") == 1)273 {274 $("#login_user").fadeOut("fast");275 $("#register_user").fadeIn("fast");276 $(this).html("Âû óæå çàðåãèñòðèðîâàííû ?");277 $(this).attr("register", "0");278 }279 else280 {281 $("#login_user").fadeIn("fast");282 $("#register_user").fadeOut("fast");283 $(this).html("Íå çàðåãèñòðèðîâàííû ?");284 $(this).attr("register", "1");285 }286 return false;287 });288 289 290 $("#repassword").click(function(){291 292 $("#repassword_user").css({"top" : $(this).offset().top, "left" : $(this).offset().left-100 })293 .fadeIn("fast");294 return false;295 });296 $("#repassword_close").click(function(){297 298 $("#repassword_user").fadeOut("fast");299 return false;300 });301 $("#repassword_form").submit(function(){302 if (validator_repassword.form())303 {304 var email = $("input[name='repassword_email']").val();305 $.post('http://' + location.hostname + '/cabinet/', {submit_restore : 1, email : email}, 306 function(response){307 if (response == 1)308 $("#repassword_msg").html("Íîâûé ïàðîëü âûñëàí íà âàø email");309 else310 $("#repassword_msg").html("Ïàðîëü íå âîññòàíîâëåí");311 });312 }313 return false;314 });315 316 317 var validator_repassword = $("FORM#repassword_form").validate(318 {319 errorPlacement: function(error, element) {320 error.insertAfter( element );321 },322 323 rules:324 {325 repassword_email : {required: true, email : true}326 },327 328 messages:329 {330 repassword_email: {331 required : "Ââåäèòå email",332 email : "Íåâåðíûé ôîðìàò"333 }334 }335 }336 );337 338 339 340 //ëåâîå ìåíþ, ÷òî-òî âðîäå àíèìàöèè341 $("A.lmenuf:not(.static)").click( function(){342 var submenu = $("DIV#subitem_" + $(this).attr("id"));343 if ($(submenu).css("display") != "block" )344 {345 $("DIV.submenu").fadeOut().animate({opacity:.5}, 100);346 $(submenu).animate({opacity:1},250).fadeIn("fast");347 }348 return false;349 } );350 351 352 //çàêàç ïðîäóêòà íà îòäåëüíîé ñòðàíèöå353 $("FORM#form_order_single").submit(function(){354 if (form_order_single_validate.form())355 {356 //ïîëó÷àåì îòâåò îò ñåðâåðà357 this.response = function(response){358 $("DIV#loading-layer").hide();359 var floor = response.split(";");360 361 if (floor[0] == "error_count")362 {363 if (floor[1] > 0)364 alert("Êîëè÷åñòâî çàêàçà íå ìîæåò ïðåâûøàòü: " + floor[1]);365 else366 alert("Òîâàð çàêîí÷èëñÿ íà ñêëàäå.");367 return false;368 }369 370 371 $("#basket_number").html(floor[0]);372 $("#basket_currency").html(floor[1]);373 };374 375 376 var product_id = $("input[name='product_id']", $(this)).val();377 var product_count = $("input[name='count']", $(this)).val();378 $("DIV#loading-layer").show();379 //êèäàåì çàïðîñ íà ñåðâåð380 $.post('http://' + location.hostname + '/shop/basket/add/', 381 {product_id : product_id, product_count : product_count}, 382 this.response );383 384 385 }386 return false;387 });388 389 390 391 var form_order_single_validate = $("FORM#form_order_single").validate(392 {393 394 errorPlacement: function(error, element) {395 error.insertAfter( element );396 },397 398 rules:399 {400 count : {required: true, number : true}401 },402 messages:403 {404 count: {405 required : "Ââåäèòå ÷èñëî",406 number : "Ââîäèòå òîëüêî ÷èñëà"407 }408 }409 }410 );411 412 413 //çàêàç èç ñïèñêà ïðîäóêòîâ â êàòåãîðèè414 $("input[name='add_order']").click(function(){415 416 this.response = function(response){417 $("DIV#loading-layer").hide();418 var floor = response.split(";");419 420 if (floor[0] == "error_count")421 {422 if (floor[1] > 0)423 alert("Êîëè÷åñòâî çàêàçà íå ìîæåò ïðåâûøàòü: " + floor[1]);424 else425 alert("Òîâàð çàêîí÷èëñÿ íà ñêëàäå.");426 return false;427 }428 429 $("#basket_number").html(floor[0]);430 $("#basket_currency").html(floor[1]);431 };432 433 434 var product_count = $("td input[type='text']", $(this).parent().parent()).val();435 var product_id = $("td input[type='text']", $(this).parent().parent()).attr("name");436 if (parseInt(product_count) > 0 && parseInt(product_id) > 0)437 {438 $("DIV#loading-layer").show();439 //êèäàåì çàïðîñ íà ñåðâåð440 $.post('http://' + location.hostname + '/shop/basket/add/', 441 {product_id : product_id, product_count : product_count}, 442 this.response );443 444 }445 return false;446 });447 448 var validator = $("FORM#RegisterForm").validate(449 {450 451 errorPlacement: function(error, element) {452 error.insertAfter( element );453 },454 455 rules:456 {457 email : {required: true, email : true, remote : 'http://' + location.hostname + '/shop/ajax/checkemail/'},458 tel : {required: true},459 name : {required: true},460 password : {required : true, minlength : 6},461 password_again : {equalTo : "#password"}462 },463 messages:464 {465 email: {466 required : "Ââåäèòå email",467 email : "Íåâåðíûé ôîðìàò",468 remote : "Òàêîé email óæå çàðåãèñòðèðîâàí"469 },470 tel: {471 required : "Ââåäèòå êîíòàêòíûé òåëåôîí"472 },473 name: {474 required : "Ââåäèòå âàøå èìÿ"475 },476 password : {477 required : "Ââåäèòå ïàðîëü",478 minlength : "Ìèíèìàëüíàÿ äëèíà ïàðîëÿ 4 ñèìâîëà"479 },480 password_again : "Ïàðîëè íå ñîâïàäàþò"481 482 }483 }484 );485 486 $("A#i_registered").click(function(){487 if ($("FORM#Registration").css('display') == 'block')488 {489 $("FORM#Registration").hide();490 $("FORM#Auth").show();491 $(this).html("ß íå çàðåãèñòðèðîâàí");492 }493 else494 {495 $("FORM#Auth").hide();496 $("FORM#Registration").show();497 $(this).html("ß óæå çàðåãèñòðèðîâàí");498 }499 return false;500 });501 502} );...

Full Screen

Full Screen

tools_17-10-11.js

Source:tools_17-10-11.js Github

copy

Full Screen

1$(document).ready( function(){2 $("a.CatalogImages").click(function(){3 var src = $(this).attr("image");4 if ($.trim(src) == "") return false;5 $("#ImageLayout").empty();6 $("#ImageLayout").append( $("<IMG>").attr("src", src).click(function(){ $("#ImageLayout").hide(); }) );7 $("#ImageLayout").css({"left" : $(this).offset().left, "top" : $(this).offset().top} ).show();8 return false;9 });10 $("#ImageLayout").click(function(){ $(this).hide(); });11 $("#submit_basket_form").submit(function(){12 //alert($("input[name='payment']:checked", $("form#submit_basket_form")).val());13 //return false;14 //åñëè àâòîðèçîâàí, òî ñðàçó äåëàåì çàêàç15 if ( $("#register").val() == 1 )16 {17 $("input[name='submit_basket'][type='image']").attr("disabled", "true").fadeOut("fast");18 $.post('http://' + location.hostname + '/shop/basket/submit/', {19 submit_order : 1,20 dostavka : $("input[name='dostavka']:checked", $("form#submit_basket_form")).val(),21 company_dost : $("input[name='company_dost']:checked", $("form#submit_basket_form")).val(),22 payment : $("input[name='payment']:checked", $("form#submit_basket_form")).val(),23 company : $("input[name='company']", $("form#submit_basket_form")).val(),24 inn : $("input[name='inn']", $("form#submit_basket_form")).val(),25 kpp : $("input[name='kpp']", $("form#submit_basket_form")).val(),26 comment : $("textarea[name='comment']", $("form#submit_basket_form")).val()27 }, function(response) { location = 'http://' + location.hostname + '/shop/basket/final/'; } );28 29 }30 else31 //èíà÷å ðåãèì/ëîãèíèì32 {33 //àâòîðèçàöèÿ34 if ($("#question").attr("register") == 1)35 {36 37 //if (login_validate.form())38 {39 $.post('http://' + location.hostname + '/cabinet/login/', {40 submit_login : 1,41 login_email : $("input[name='login_email']", $("form#login_user_form")).val(),42 login_pass : $("input[name='login_pass']", $("form#login_user_form")).val()43 }, function(response){ 44 if (response != 1)45 {46 switch(response)47 {48 case "error1":49 $("#response_server").html("Íåïðàâèëüíûé ôîðìàò e-mail àäðåñà");50 break;51 case "error2":52 $("#response_server").html("Íåâåðíàÿ ïàðà ëîãèí/ïàðîëü");53 break;54 }55 }56 else57 {58 //$("#submit_basket_form").submit();59 $("input[name='submit_basket'][type='image']").attr("disabled", "true").fadeOut("fast");60 $.post('http://' + location.hostname + '/shop/basket/submit/', {61 submit_order : 1,62 dostavka : $("input[name='dostavka']:checked", $("form#submit_basket_form")).val(),63 company_dost : $("input[name='company_dost']:checked", $("form#submit_basket_form")).val(),64 payment : $("input[name='payment']:checked", $("form#submit_basket_form")).val(),65 company : $("input[name='company']", $("form#submit_basket_form")).val(),66 inn : $("input[name='inn']", $("form#submit_basket_form")).val(),67 kpp : $("input[name='kpp']", $("form#submit_basket_form")).val(),68 comment : $("textarea[name='comment']", $("form#submit_basket_form")).val()69 }, function(response) { location = 'http://' + location.hostname + '/shop/basket/final/'; } );70 return false;71 }72 } );73 }74 }75 else76 {77 //ðåãèñòðàöèÿ78 79 //if (register_validate.form())80 {81 82 $.post('http://' + location.hostname + '/cabinet/register/',{83 84 submit_user_register : 1,85 username : $("input[name='username']", $("form#register_user_form")).val(),86 useremail : $("input[name='useremail']", $("form#register_user_form")).val(),87 phone : $("input[name='phone']", $("form#register_user_form")).val(),88 address : $("input[name='address']", $("form#register_user_form")).val(),89 pass : $("input[name='pass']", $("form#register_user_form")).val()90 }, function(response){ 91 92 if (response != 1)93 {94 switch(response)95 {96 case "error1":97 $("#response_server").html("Íåïðàâèëüíûé ôîðìàò e-mail àäðåñà");98 break;99 case "error2":100 $("#response_server").html("Ïîëüçîâàòåëü ñ òàêèì ïî÷òîâûì àäðåñîì óæå ñóùåñòâóåò");101 break;102 }103 }104 else105 {106 $("input[name='submit_basket'][type='image']").attr("disabled", "true").fadeOut("fast");107 $.post('http://' + location.hostname + '/shop/basket/submit/', {108 submit_order : 1,109 dostavka : $("input[name='dostavka']:checked", $("form#submit_basket_form")).val(),110 company_dost : $("input[name='company_dost']:checked", $("form#submit_basket_form")).val(),111 payment : $("input[name='payment']:checked", $("form#submit_basket_form")).val(),112 company : $("input[name='company']", $("form#submit_basket_form")).val(),113 inn : $("input[name='inn']", $("form#submit_basket_form")).val(),114 kpp : $("input[name='kpp']", $("form#submit_basket_form")).val(),115 comment : $("textarea[name='comment']", $("form#submit_basket_form")).val()116 }, function(response) { location = 'http://' + location.hostname + '/shop/basket/final/'; } );117 118 }119 })120 }121 }122 123 }124 return false;125 });126 127 128 //ðåãèñòðàöèÿ/ëîãèí ïðè çàêàçå129 $("#register_login").click(function(){130 131 if ($("#question").attr("register") == 1)132 {133 if (login_validate.form())134 {135 $("form#login_user_form").submit();136 }137 }138 else139 {140 if (register_validate.form())141 {142 $("form#register_user_form").submit();143 }144 }145 146 });147 148 $("form#restore_password_form").submit(function(){149 return restore_validate.form();150 });151 var restore_validate = $("form#restore_password_form").validate(152 {153 154 errorPlacement: function(error, element) {155 error.insertAfter( element );156 },157 158 rules:159 {160 email : {required: true, email : true}161 },162 messages:163 {164 email: {165 required : "Ââåäèòå email",166 email : "Íåâåðíûé ôîðìàò email"167 }168 }169 }170 );171 172 173 174 var login_validate = $("form#login_user_form").validate(175 {176 177 errorPlacement: function(error, element) {178 error.insertAfter( element );179 },180 181 rules:182 {183 login_email : {required: true, email : true},184 login_pass : {required: true}185 },186 messages:187 {188 login_email: {189 required : "Ââåäèòå email",190 email : "Íåâåðíûé ôîðìàò email"191 },192 login_pass: {193 required : "Ââåäèòå ïàðîëü"194 }195 }196 }197 );198 199 var register_validate = $("form#register_user_form").validate(200 {201 202 errorPlacement: function(error, element) {203 error.insertAfter( element );204 },205 206 rules:207 {208 username : {required: true},209 phone : {required: true},210 useremail : {required: true, email:true},211 address : {required: true}212 //pass: {required: true}213 },214 messages:215 {216 username: {217 required : "Ââåäèòå èìÿ"218 },219 phone: {220 required : "Ââåäèòå òåëåôîí"221 },222 useremail: {223 required : "Ââåäèòå email",224 email : "Íåâåðíûé ôîðìàò email"225 },226 address: {227 required : "Ââåäèòå àäðåñ"228 }229 /*pass: {230 required : "Ââåäèòå ïàðîëü"231 }*/232 }233 }234 );235 236 237 238 var comment_validate = $("form#add_comment").validate(239 {240 241 errorPlacement: function(error, element) {242 error.insertAfter( element );243 },244 245 rules:246 {247 bvz : {required: true},248 tvfbk : {required: true, email : true},249 ntrcn : {required: true}250 },251 messages:252 {253 bvz: {254 required : "Ââåäèòå âàøå èìÿ"255 },256 257 tvfbk: {258 required : "Ââåäèòå email",259 email : "Íåâåðíûé ôîðìàò email"260 },261 262 ntrcn: {263 required : "Ââåäèòå êîììåíòàðèé"264 }265 266 }267 }268 );269 270 //ññûëêà ïîêàçàòü/ñêðûòü ôîðìó ðåãèñòðàöèè/ëîãèíà271 $("A#question").click(function(){272 if ($(this).attr("register") == 1)273 {274 $("#login_user").fadeOut("fast");275 $("#register_user").fadeIn("fast");276 $(this).html("Âû óæå çàðåãèñòðèðîâàííû ?");277 $(this).attr("register", "0");278 }279 else280 {281 $("#login_user").fadeIn("fast");282 $("#register_user").fadeOut("fast");283 $(this).html("Íå çàðåãèñòðèðîâàííû ?");284 $(this).attr("register", "1");285 }286 return false;287 });288 289 290 $("#repassword").click(function(){291 292 $("#repassword_user").css({"top" : $(this).offset().top, "left" : $(this).offset().left-100 })293 .fadeIn("fast");294 return false;295 });296 $("#repassword_close").click(function(){297 298 $("#repassword_user").fadeOut("fast");299 return false;300 });301 $("#repassword_form").submit(function(){302 if (validator_repassword.form())303 {304 var email = $("input[name='repassword_email']").val();305 $.post('http://' + location.hostname + '/cabinet/', {submit_restore : 1, email : email}, 306 function(response){307 if (response == 1)308 $("#repassword_msg").html("Íîâûé ïàðîëü âûñëàí íà âàø email");309 else310 $("#repassword_msg").html("Ïàðîëü íå âîññòàíîâëåí");311 });312 }313 return false;314 });315 316 317 var validator_repassword = $("FORM#repassword_form").validate(318 {319 errorPlacement: function(error, element) {320 error.insertAfter( element );321 },322 323 rules:324 {325 repassword_email : {required: true, email : true}326 },327 328 messages:329 {330 repassword_email: {331 required : "Ââåäèòå email",332 email : "Íåâåðíûé ôîðìàò"333 }334 }335 }336 );337 338 339 340 //ëåâîå ìåíþ, ÷òî-òî âðîäå àíèìàöèè341 $("A.lmenuf:not(.static)").click( function(){342 var submenu = $("DIV#subitem_" + $(this).attr("id"));343 if ($(submenu).css("display") != "block" )344 {345 $("DIV.submenu").fadeOut().animate({opacity:.5}, 100);346 $(submenu).animate({opacity:1},250).fadeIn("fast");347 }348 return false;349 } );350 351 352 //çàêàç ïðîäóêòà íà îòäåëüíîé ñòðàíèöå353 $("FORM#form_order_single").submit(function(){354 if (form_order_single_validate.form())355 {356 //ïîëó÷àåì îòâåò îò ñåðâåðà357 this.response = function(response){358 $("DIV#loading-layer").hide();359 var floor = response.split(";");360 $("#basket_number").html(floor[0]);361 $("#basket_currency").html(floor[1]);362 };363 364 365 var product_id = $("input[name='product_id']", $(this)).val();366 var product_count = $("input[name='count']", $(this)).val();367 $("DIV#loading-layer").show();368 //êèäàåì çàïðîñ íà ñåðâåð369 $.post('http://' + location.hostname + '/shop/basket/add/', 370 {product_id : product_id, product_count : product_count}, 371 this.response );372 373 374 }375 return false;376 });377 378 379 380 var form_order_single_validate = $("FORM#form_order_single").validate(381 {382 383 errorPlacement: function(error, element) {384 error.insertAfter( element );385 },386 387 rules:388 {389 count : {required: true, number : true}390 },391 messages:392 {393 count: {394 required : "Ââåäèòå ÷èñëî",395 number : "Ââîäèòå òîëüêî ÷èñëà"396 }397 }398 }399 );400 401 402 //çàêàç èç ñïèñêà ïðîäóêòîâ â êàòåãîðèè403 $("input[name='add_order']").click(function(){404 405 this.response = function(response){406 $("DIV#loading-layer").hide();407 var floor = response.split(";");408 409 if (floor[0] == "error_count")410 {411 if (floor[1] > 0)412 alert("Êîëè÷åñòâî çàêàçà íå ìîæåò ïðåâûøàòü: " + floor[1]);413 else414 alert("Òîâàð çàêîí÷èëñÿ íà ñêëàäå.");415 return false;416 }417 418 $("#basket_number").html(floor[0]);419 $("#basket_currency").html(floor[1]);420 };421 422 423 var product_count = $("td input[type='text']", $(this).parent().parent()).val();424 var product_id = $("td input[type='text']", $(this).parent().parent()).attr("name");425 if (parseInt(product_count) > 0 && parseInt(product_id) > 0)426 {427 $("DIV#loading-layer").show();428 //êèäàåì çàïðîñ íà ñåðâåð429 $.post('http://' + location.hostname + '/shop/basket/add/', 430 {product_id : product_id, product_count : product_count}, 431 this.response );432 433 }434 return false;435 });436 437 var validator = $("FORM#RegisterForm").validate(438 {439 440 errorPlacement: function(error, element) {441 error.insertAfter( element );442 },443 444 rules:445 {446 email : {required: true, email : true, remote : 'http://' + location.hostname + '/shop/ajax/checkemail/'},447 tel : {required: true},448 name : {required: true},449 password : {required : true, minlength : 6},450 password_again : {equalTo : "#password"}451 },452 messages:453 {454 email: {455 required : "Ââåäèòå email",456 email : "Íåâåðíûé ôîðìàò",457 remote : "Òàêîé email óæå çàðåãèñòðèðîâàí"458 },459 tel: {460 required : "Ââåäèòå êîíòàêòíûé òåëåôîí"461 },462 name: {463 required : "Ââåäèòå âàøå èìÿ"464 },465 password : {466 required : "Ââåäèòå ïàðîëü",467 minlength : "Ìèíèìàëüíàÿ äëèíà ïàðîëÿ 4 ñèìâîëà"468 },469 password_again : "Ïàðîëè íå ñîâïàäàþò"470 471 }472 }473 );474 475 $("A#i_registered").click(function(){476 if ($("FORM#Registration").css('display') == 'block')477 {478 $("FORM#Registration").hide();479 $("FORM#Auth").show();480 $(this).html("ß íå çàðåãèñòðèðîâàí");481 }482 else483 {484 $("FORM#Auth").hide();485 $("FORM#Registration").show();486 $(this).html("ß óæå çàðåãèñòðèðîâàí");487 }488 return false;489 });490 491} );...

Full Screen

Full Screen

listener.js

Source:listener.js Github

copy

Full Screen

1/* Fix the Jquery serialize so that it works with ISO-8859-1 */2jQuery.fn.extend({3 param: function( a ) {4 var s = [];5 6 // If an array was passed in, assume that it is an array7 // of form elements8 if ( a.constructor == Array || a.jquery ){9 // Serialize the form elements10 jQuery.each( a, function(){11 s.push(unescape(encodeURIComponent(escape(this.name))) + "=" + unescape(encodeURIComponent(escape(this.value))));12 });13 }14 // Otherwise, assume that it's an object of key/value pairs15 else{16 // Serialize the key/values17 for ( var j in a )18 // If the value is an array then the key names need to be repeated19 if ( a[j] && a[j].constructor == Array )20 jQuery.each( a[j], function(){21 s.push(unescape(encodeURIComponent(escape(j)) + "=" + encodeURIComponent(escape(this))));22 });23 else24 s.push(unescape(encodeURIComponent(escape(j)) + "=" + encodeURIComponent(escape(a[j]))));25 }26 // Return the resulting serialization27 return s.join("&").replace(/ /g, "+");28 },29 serialize: function() {30 return this.param(this.serializeArray());31 }32 33}); 34$(document).ready(function(){ 35 $("#add-invoice-form").submit(function(){ 36 $.post( 37 "add_transaction.php", 38 $("#add-invoice-form").serialize(), 39 function(data){ 40 $("#result-dialog").html(data);41 $("#result-dialog").dialog({ buttons: { "Ok": function() { $(this).dialog("close"); } } });42 } 43 ); 44 }); 45}); 46$(document).ready(function(){ 47 $("#get-address-form").submit(function(){ 48 $.post( 49 "get_addresses.php", 50 $("#get-address-form").serialize(), 51 function(data){ 52 $("#result-dialog").html(data);53 $("#result-dialog").dialog({ buttons: { "Ok": function() { $(this).dialog("close"); } } });54 } 55 ); 56 }); 57}); 58$(document).ready(function(){ 59 $("#monthly-cost-form").submit(function(){ 60 $.post( 61 "monthly_cost.php", 62 $("#monthly-cost-form").serialize(), 63 function(data){ 64 $("#result-dialog").html(data);65 $("#result-dialog").dialog({ buttons: { "Ok": function() { $(this).dialog("close"); } } });66 } 67 ); 68 }); 69}); 70$(document).ready(function(){ 71 $("#periodic-cost-form").submit(function(){ 72 $.post( 73 "periodic_cost.php", 74 $("#periodic-cost-form").serialize(), 75 function(data){ 76 $("#result-dialog").html(data);77 $("#result-dialog").dialog({ buttons: { "Ok": function() { $(this).dialog("close"); } } });78 } 79 ); 80 }); 81}); 82$(document).ready(function(){ 83 $("#activate-invoice-form").submit(function(){ 84 if(verify_invno($('#activate-invoice-form input[name$="invno"]').val()))85 {86 $.post( 87 "activate_invoice.php", 88 $("#activate-invoice-form").serialize(), 89 function(data){ 90 $("#result-dialog").html(data);91 $("#result-dialog").dialog({ buttons: { "Ok": function() { $(this).dialog("close"); } } });92 } 93 ); 94 }95 }); 96}); 97$(document).ready(function(){ 98 $("#delete-invoice-form").submit(function(){ 99 if(verify_invno($('#delete-invoice-form input[name$="invno"]').val()))100 {101 $.post( 102 "delete_invoice.php", 103 $("#delete-invoice-form").serialize(), 104 function(data){ 105 $("#result-dialog").html(data);106 $("#result-dialog").dialog({ buttons: { "Ok": function() { $(this).dialog("close"); } } });107 } 108 ); 109 }110 }); 111}); 112$(document).ready(function(){ 113 $("#return-amount-form").submit(function(){ 114 if(verify_invno($('#return-amount-form input[name$="invno"]').val()))115 {116 $.post( 117 "return_amount.php", 118 $("#return-amount-form").serialize(), 119 function(data){ 120 $("#result-dialog").html(data);121 $("#result-dialog").dialog({ buttons: { "Ok": function() { $(this).dialog("close"); } } });122 } 123 ); 124 }125 }); 126}); 127$(document).ready(function(){ 128 $("#credit-invoice-form").submit(function(){ 129 if(verify_invno($('#credit-invoice-form input[name$="invno"]').val()))130 {131 $.post( 132 "credit_invoice.php", 133 $("#credit-invoice-form").serialize(), 134 function(data){ 135 $("#result-dialog").html(data);136 $("#result-dialog").dialog({ buttons: { "Ok": function() { $(this).dialog("close"); } } });137 } 138 ); 139 }140 }); 141}); 142$(document).ready(function(){ 143 $("#credit-part-form").submit(function(){ 144 if(verify_invno($('#credit-part-form input[name$="invno"]').val()))145 {146 $.post( 147 "credit_part.php", 148 $("#credit-part-form").serialize(), 149 function(data){ 150 $("#result-dialog").html(data);151 $("#result-dialog").dialog({ buttons: { "Ok": function() { $(this).dialog("close"); } } });152 } 153 ); 154 }155 }); 156}); 157$(document).ready(function(){ 158 $("#email-invoice-form").submit(function(){ 159 if(verify_invno($('#email-invoice-form input[name$="invno"]').val()))160 {161 $.post( 162 "email_invoice.php", 163 $("#email-invoice-form").serialize(), 164 function(data){ 165 $("#result-dialog").html(data);166 $("#result-dialog").dialog({ buttons: { "Ok": function() { $(this).dialog("close"); } } });167 } 168 ); 169 }170 }); 171}); 172$(document).ready(function(){ 173 $("#send-invoice-form").submit(function(){ 174 if(verify_invno($('#send-invoice-form input[name$="invno"]').val()))175 {176 $.post( 177 "send_invoice.php", 178 $("#send-invoice-form").serialize(), 179 function(data){ 180 $("#result-dialog").html(data);181 $("#result-dialog").dialog({ buttons: { "Ok": function() { $(this).dialog("close"); } } });182 } 183 ); 184 }185 }); 186}); 187$(document).ready(function(){ 188 $("#update-goods-qty-form").submit(function(){ 189 if(verify_invno($('#update-goods-qty-form input[name$="invno"]').val()))190 {191 $.post( 192 "update_goods_qty.php", 193 $("#update-goods-qty-form").serialize(), 194 function(data){ 195 $("#result-dialog").html(data);196 $("#result-dialog").dialog({ buttons: { "Ok": function() { $(this).dialog("close"); } } });197 } 198 ); 199 }200 }); 201}); 202$(document).ready(function(){ 203 $("#update-charge-form").submit(function(){ 204 if(verify_invno($('#update-charge-form input[name$="invno"]').val()))205 {206 $.post( 207 "update_charge.php", 208 $("#update-charge-form").serialize(), 209 function(data){ 210 $("#result-dialog").html(data);211 $("#result-dialog").dialog({ buttons: { "Ok": function() { $(this).dialog("close"); } } });212 } 213 ); 214 }215 }); 216}); 217$(document).ready(function(){ 218 $("#update-orderno-form").submit(function(){ 219 if(verify_invno($('#update-orderno-form input[name$="invno"]').val()))220 {221 $.post( 222 "update_orderno.php", 223 $("#update-orderno-form").serialize(), 224 function(data){ 225 $("#result-dialog").html(data);226 $("#result-dialog").dialog({ buttons: { "Ok": function() { $(this).dialog("close"); } } });227 } 228 ); 229 }230 }); 231}); 232$(document).ready(function(){ 233 $("#invoice-addr-form").submit(function(){ 234 if(verify_invno($('#invoice-addr-form input[name$="invno"]').val()))235 {236 $.post( 237 "invoice_addr.php", 238 $("#invoice-addr-form").serialize(), 239 function(data){ 240 $("#result-dialog").html(data);241 $("#result-dialog").dialog({ buttons: { "Ok": function() { $(this).dialog("close"); } } });242 } 243 ); 244 }245 }); 246}); 247$(document).ready(function(){ 248 $("#invoice-amount-form").submit(function(){ 249 if(verify_invno($('#invoice-amount-form input[name$="invno"]').val()))250 {251 $.post( 252 "invoice_amount.php", 253 $("#invoice-amount-form").serialize(), 254 function(data){ 255 $("#result-dialog").html(data);256 $("#result-dialog").dialog({ buttons: { "Ok": function() { $(this).dialog("close"); } } });257 } 258 ); 259 }260 }); 261}); 262$(document).ready(function(){ 263 $("#invoice-part-amount-form").submit(function(){ 264 if(verify_invno($('#invoice-part-amount-form input[name$="invno"]').val()))265 {266 $.post( 267 "invoice_part_amount.php", 268 $("#invoice-part-amount-form").serialize(), 269 function(data){ 270 $("#result-dialog").html(data);271 $("#result-dialog").dialog({ buttons: { "Ok": function() { $(this).dialog("close"); } } });272 } 273 ); 274 }275 }); 276}); 277$(document).ready(function(){ 278 $("#get-pclasses-form").submit(function(){ 279 $.post( 280 "fetch_pclasses.php", 281 $("#get-pclasses-form").serialize(), 282 function(data){ 283 $("#result-dialog").html(data);284 $("#result-dialog").dialog({ buttons: { "Ok": function() { $(this).dialog("close"); } } });285 } 286 ); 287 }); 288}); 289$(document).ready(function(){ 290 $("#is-invoice-paid-form").submit(function(){ 291 $.post( 292 "is_invoice_paid.php", 293 $("#is-invoice-paid-form").serialize(), 294 function(data){ 295 $("#result-dialog").html(data);296 $("#result-dialog").dialog({ buttons: { "Ok": function() { $(this).dialog("close"); } } });297 } 298 ); 299 }); 300}); 301$(document).ready(function(){ 302 $("#reserve-amount-form").submit(function(){ 303 $.post( 304 "reserve_amount.php", 305 $("#reserve-amount-form").serialize(), 306 function(data){ 307 $("#result-dialog").html(data);308 $("#result-dialog").dialog({ buttons: { "Ok": function() { $(this).dialog("close"); } } });309 } 310 ); 311 }); 312}); 313$(document).ready(function(){ 314 $("#activate-reservation-form").submit(function(){ 315 $.post( 316 "activate_reservation.php", 317 $("#activate-reservation-form").serialize(), 318 function(data){ 319 $("#result-dialog").html(data);320 $("#result-dialog").dialog({ buttons: { "Ok": function() { $(this).dialog("close"); } } });321 } 322 ); 323 }); 324}); 325$(document).ready(function(){ 326 $("#cancel-reservation-form").submit(function(){ 327 $.post( 328 "cancel_reservation.php", 329 $("#cancel-reservation-form").serialize(), 330 function(data){331 $("#result-dialog").html(data);332 $("#result-dialog").dialog({ buttons: { "Ok": function() { $(this).dialog("close"); } } });333 }334 ); 335 }); 336}); 337$(document).ready(function(){ 338 $("#split-reservation-form").submit(function(){ 339 $.post( 340 "split_reservation.php", 341 $("#split-reservation-form").serialize(), 342 function(data){343 $("#result-dialog").html(data);344 $("#result-dialog").dialog({ buttons: { "Ok": function() { $(this).dialog("close"); } } });345 }346 ); 347 }); 348}); 349$(document).ready(function(){ 350 $("#change-reservation-form").submit(function(){ 351 $.post( 352 "change_reservation.php", 353 $("#change-reservation-form").serialize(), 354 function(data){355 $("#result-dialog").html(data);356 $("#result-dialog").dialog({ buttons: { "Ok": function() { $(this).dialog("close"); } } });357 }358 ); 359 }); 360}); 361$(document).ready(function(){ 362 $("#reserve-ocrs-form").submit(function(){ 363 $.post( 364 "reserve_ocrs.php", 365 $("#reserve-ocrs-form").serialize(), 366 function(data){367 $("#result-dialog").html(data);368 $("#result-dialog").dialog({ buttons: { "Ok": function() { $(this).dialog("close"); } } });369 }370 ); 371 }); 372}); 373$(document).ready(function(){ 374 $("#estore-info").submit(function(){ 375 $.post( 376 "estore_set.php", 377 $("#estore-info").serialize(), 378 function(data){379 $("#result-dialog").html(data);380 $("#result-dialog").dialog({ buttons: { "Ok": function() { $(this).dialog("close"); } } });381 }382 ); 383 }); ...

Full Screen

Full Screen

script.js

Source:script.js Github

copy

Full Screen

1$(function(){2 3 // Checking for CSS 3D transformation support4 $.support.css3d = supportsCSS3D();5 6 7 8 // efecto para un cuadrado incio9 10 var formContainer = $('#formContainer');11 12 // Listening for clicks on the ribbon links13 $('.flipLink').click(function(e){14 15 // Flipping the forms16 formContainer.toggleClass('flipped');17 18 // If there is no CSS3 3D support, simply19 // hide the login form (exposing the recover one)20 if(!$.support.css3d){21 $('#login-calvin').toggle();22 }23 e.preventDefault();24 });25 26 formContainer.find('form').submit(function(e){27 // Preventing form submissions. If you implement28 // a backend, you might want to remove this code29 e.preventDefault();30 });31 //final de efecto para un cuadrado32 33 34 35var formContainer2 = $('#formContainer2');36 37 // Listening for clicks on the ribbon links38 $('.flipLink2').click(function(e){39 40 // Flipping the forms41 formContainer2.toggleClass('flipped');42 43 // If there is no CSS3 3D support, simply44 // hide the login form (exposing the recover one)45 if(!$.support.css3d){46 $('#login-david').toggle();47 }48 e.preventDefault();49 });50 51 formContainer2.find('form').submit(function(e){52 // Preventing form submissions. If you implement53 // a backend, you might want to remove this code54 e.preventDefault();55 });56 57 58 59 60 var formContainer3 = $('#formContainer3');61 62 // Listening for clicks on the ribbon links63 $('.flipLink3').click(function(e){64 65 // Flipping the forms66 formContainer3.toggleClass('flipped');67 68 // If there is no CSS3 3D support, simply69 // hide the login form (exposing the recover one)70 if(!$.support.css3d){71 $('#login-infected').toggle();72 }73 e.preventDefault();74 });75 76 formContainer3.find('form').submit(function(e){77 // Preventing form submissions. If you implement78 // a backend, you might want to remove this code79 e.preventDefault();80 });81 82 83 84 var formContainer4 = $('#formContainer4');85 86 // Listening for clicks on the ribbon links87 $('.flipLink4').click(function(e){88 89 // Flipping the forms90 formContainer4.toggleClass('flipped');91 92 // If there is no CSS3 3D support, simply93 // hide the login form (exposing the recover one)94 if(!$.support.css3d){95 $('#login-kaden').toggle();96 }97 e.preventDefault();98 });99 100 formContainer4.find('form').submit(function(e){101 // Preventing form submissions. If you implement102 // a backend, you might want to remove this code103 e.preventDefault();104 });105var formContainer5 = $('#formContainer5');106 107 // Listening for clicks on the ribbon links108 $('.flipLink5').click(function(e){109 110 // Flipping the forms111 formContainer5.toggleClass('flipped');112 113 // If there is no CSS3 3D support, simply114 // hide the login form (exposing the recover one)115 if(!$.support.css3d){116 $('#login').toggle();117 }118 e.preventDefault();119 });120 121 formContainer5.find('form').submit(function(e){122 // Preventing form submissions. If you implement123 // a backend, you might want to remove this code124 e.preventDefault();125 });126var formContainer6 = $('#formContainer6');127 128 // Listening for clicks on the ribbon links129 $('.flipLink6').click(function(e){130 131 // Flipping the forms132 formContainer6.toggleClass('flipped');133 134 // If there is no CSS3 3D support, simply135 // hide the login form (exposing the recover one)136 if(!$.support.css3d){137 $('#login').toggle();138 }139 e.preventDefault();140 });141 142 formContainer6.find('form').submit(function(e){143 // Preventing form submissions. If you implement144 // a backend, you might want to remove this code145 e.preventDefault();146 });147 148 149 150 var formContainer7 = $('#formContainer7');151 152 // Listening for clicks on the ribbon links153 $('.flipLink7').click(function(e){154 155 // Flipping the forms156 formContainer7.toggleClass('flipped');157 158 // If there is no CSS3 3D support, simply159 // hide the login form (exposing the recover one)160 if(!$.support.css3d){161 $('#login').toggle();162 }163 e.preventDefault();164 });165 166 formContainer7.find('form').submit(function(e){167 // Preventing form submissions. If you implement168 // a backend, you might want to remove this code169 e.preventDefault();170 });171var formContainer8 = $('#formContainer8');172 173 // Listening for clicks on the ribbon links174 $('.flipLink8').click(function(e){175 176 // Flipping the forms177 formContainer8.toggleClass('flipped');178 179 // If there is no CSS3 3D support, simply180 // hide the login form (exposing the recover one)181 if(!$.support.css3d){182 $('#login').toggle();183 }184 e.preventDefault();185 });186 187 formContainer8.find('form').submit(function(e){188 // Preventing form submissions. If you implement189 // a backend, you might want to remove this code190 e.preventDefault();191 });192 193 194 var formContainer9 = $('#formContainer9');195 196 // Listening for clicks on the ribbon links197 $('.flipLink9').click(function(e){198 199 // Flipping the forms200 formContainer9.toggleClass('flipped');201 202 // If there is no CSS3 3D support, simply203 // hide the login form (exposing the recover one)204 if(!$.support.css3d){205 $('#login').toggle();206 }207 e.preventDefault();208 });209 210 formContainer9.find('form').submit(function(e){211 // Preventing form submissions. If you implement212 // a backend, you might want to remove this code213 e.preventDefault();214 });215 216 var formContainer10 = $('#formContainer10');217 218 // Listening for clicks on the ribbon links219 $('.flipLink10').click(function(e){220 221 // Flipping the forms222 formContainer10.toggleClass('flipped');223 224 // If there is no CSS3 3D support, simply225 // hide the login form (exposing the recover one)226 if(!$.support.css3d){227 $('#login').toggle();228 }229 e.preventDefault();230 });231 232 formContainer10.find('form').submit(function(e){233 // Preventing form submissions. If you implement234 // a backend, you might want to remove this code235 e.preventDefault();236 });237 238 239 var formContainer11 = $('#formContainer11');240 241 // Listening for clicks on the ribbon links242 $('.flipLink11').click(function(e){243 244 // Flipping the forms245 formContainer11.toggleClass('flipped');246 247 // If there is no CSS3 3D support, simply248 // hide the login form (exposing the recover one)249 if(!$.support.css3d){250 $('#login').toggle();251 }252 e.preventDefault();253 });254 255 formContainer11.find('form').submit(function(e){256 // Preventing form submissions. If you implement257 // a backend, you might want to remove this code258 e.preventDefault();259 });260 261 var formContainer12 = $('#formContainer12');262 263 // Listening for clicks on the ribbon links264 $('.flipLink12').click(function(e){265 266 // Flipping the forms267 formContainer12.toggleClass('flipped');268 269 // If there is no CSS3 3D support, simply270 // hide the login form (exposing the recover one)271 if(!$.support.css3d){272 $('#login').toggle();273 }274 e.preventDefault();275 });276 277 formContainer12.find('form').submit(function(e){278 // Preventing form submissions. If you implement279 // a backend, you might want to remove this code280 e.preventDefault();281 });282 283 var formContainer13 = $('#formContainer13');284 285 // Listening for clicks on the ribbon links286 $('.flipLink13').click(function(e){287 288 // Flipping the forms289 formContainer13.toggleClass('flipped');290 291 // If there is no CSS3 3D support, simply292 // hide the login form (exposing the recover one)293 if(!$.support.css3d){294 $('#login').toggle();295 }296 e.preventDefault();297 });298 299 formContainer13.find('form').submit(function(e){300 // Preventing form submissions. If you implement301 // a backend, you might want to remove this code302 e.preventDefault();303 });304 305 var formContainer14 = $('#formContainer14');306 307 // Listening for clicks on the ribbon links308 $('.flipLink14').click(function(e){309 310 // Flipping the forms311 formContainer14.toggleClass('flipped');312 313 // If there is no CSS3 3D support, simply314 // hide the login form (exposing the recover one)315 if(!$.support.css3d){316 $('#login').toggle();317 }318 e.preventDefault();319 });320 321 formContainer14.find('form').submit(function(e){322 // Preventing form submissions. If you implement323 // a backend, you might want to remove this code324 e.preventDefault();325 });326 327 var formContainer15 = $('#formContainer15');328 329 // Listening for clicks on the ribbon links330 $('.flipLink15').click(function(e){331 332 // Flipping the forms333 formContainer15.toggleClass('flipped');334 335 // If there is no CSS3 3D support, simply336 // hide the login form (exposing the recover one)337 if(!$.support.css3d){338 $('#login').toggle();339 }340 e.preventDefault();341 });342 343 formContainer15.find('form').submit(function(e){344 // Preventing form submissions. If you implement345 // a backend, you might want to remove this code346 e.preventDefault();347 });348 349 var formContainer16 = $('#formContainer16');350 351 // Listening for clicks on the ribbon links352 $('.flipLink16').click(function(e){353 354 // Flipping the forms355 formContainer16.toggleClass('flipped');356 357 // If there is no CSS3 3D support, simply358 // hide the login form (exposing the recover one)359 if(!$.support.css3d){360 $('#login').toggle();361 }362 e.preventDefault();363 });364 365 formContainer16.find('form').submit(function(e){366 // Preventing form submissions. If you implement367 // a backend, you might want to remove this code368 e.preventDefault();369 });370 371 var formContainer17 = $('#formContainer17');372 373 // Listening for clicks on the ribbon links374 $('.flipLink17').click(function(e){375 376 // Flipping the forms377 formContainer17.toggleClass('flipped');378 379 // If there is no CSS3 3D support, simply380 // hide the login form (exposing the recover one)381 if(!$.support.css3d){382 $('#login').toggle();383 }384 e.preventDefault();385 });386 387 formContainer17.find('form').submit(function(e){388 // Preventing form submissions. If you implement389 // a backend, you might want to remove this code390 e.preventDefault();391 });392 var formContainer18 = $('#formContainer18');393 394 // Listening for clicks on the ribbon links395 $('.flipLink18').click(function(e){396 397 // Flipping the forms398 formContainer18.toggleClass('flipped');399 400 // If there is no CSS3 3D support, simply401 // hide the login form (exposing the recover one)402 if(!$.support.css3d){403 $('#login').toggle();404 }405 e.preventDefault();406 });407 408 formContainer18.find('form').submit(function(e){409 // Preventing form submissions. If you implement410 // a backend, you might want to remove this code411 e.preventDefault();412 });413 414 var formContainer19 = $('#formContainer19');415 416 // Listening for clicks on the ribbon links417 $('.flipLink19').click(function(e){418 419 // Flipping the forms420 formContainer19.toggleClass('flipped');421 422 // If there is no CSS3 3D support, simply423 // hide the login form (exposing the recover one)424 if(!$.support.css3d){425 $('#login').toggle();426 }427 e.preventDefault();428 });429 430 formContainer19.find('form').submit(function(e){431 // Preventing form submissions. If you implement432 // a backend, you might want to remove this code433 e.preventDefault();434 });435436 437 // A helper function that checks for the 438 // support of the 3D CSS3 transformations.439 function supportsCSS3D() {440 var props = [441 'perspectiveProperty', 'WebkitPerspective', 'MozPerspective'442 ], testDom = document.createElement('a');443 444 for(var i=0; i<props.length; i++){445 if(props[i] in testDom.style){446 return true;447 }448 }449 450 return false;451 } ...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var webdriverio = require('webdriverio');2var options = {3 desiredCapabilities: {4 }5};6 .remote(options)7 .init()8 .setValue('input[type="text"]', 'webdriverio')9 .submitForm('form')10 .pause(5000)11 .end();12var webdriverio = require('webdriverio');13var options = {14 desiredCapabilities: {15 }16};17 .remote(options)18 .init()19 .setValue('input[type="text"]', 'webdriverio')20 .submitForm('form')21 .pause(5000)22 .end();23var webdriverio = require('webdriverio');24var options = {25 desiredCapabilities: {26 }27};28 .remote(options)29 .init()30 .setValue('input[type="text"]', 'webdriverio')31 .submitForm('form')32 .pause(5000)33 .end();34var webdriverio = require('webdriverio');35var options = {36 desiredCapabilities: {

Full Screen

Using AI Code Generation

copy

Full Screen

1const wdio = require("webdriverio");2const opts = {3 desiredCapabilities: {4 }5};6(async () => {7 const client = await wdio.remote(opts);8 await client.pause(2000);9 const email = await client.$("~Compose");10 await email.click();11 const to = await client.$("~To");12 await to.setValue("

Full Screen

Using AI Code Generation

copy

Full Screen

1const wd = require('wd');2const chai = require('chai');3const chaiAsPromised = require('chai-as-promised');4chai.use(chaiAsPromised);5const expect = chai.expect;6const caps = {

Full Screen

Using AI Code Generation

copy

Full Screen

1var wd = require('wd');2var assert = require('assert');3var chai = require('chai');4var chaiAsPromised = require('chai-as-promised');5chai.use(chaiAsPromised);6var should = chai.should();7var desired = {8};9var driver = wd.promiseChainRemote('localhost', 4723);10driver.init(desired).then(function() {11}).then(function() {12 return driver.elementById('lst-ib').sendKeys('Hello World');13}).then(function() {14 return driver.elementById('lst-ib').getAttribute('value');15}).then(function(value) {16 value.should.equal('Hello World');17}).then(function() {18 return driver.elementByName('btnK').submit();19}).then(function() {20 return driver.title();21}).then(function(title) {22 title.should.equal('Hello World - Google Search');23}).fin(function() {24 return driver.quit();25}).done();

Full Screen

Using AI Code Generation

copy

Full Screen

1driver.executeScript("mobile: submit", {"element": "elementID"});2driver.executeScript("mobile: submit", {"element": "elementID", "id": "elementID"});3driver.executeScript("mobile: submit", {"element": "elementID", "id": "elementID", "name": "elementID"});4driver.executeScript("mobile: submit", {"element": "elementID", "id": "elementID", "name": "elementID", "type": "elementID"});5driver.executeScript("mobile: submit", {"element": "elementID", "id": "elementID", "name": "elementID", "type": "elementID", "label": "elementID"});6driver.executeScript("mobile: submit", {"element": "elementID", "id": "elementID", "name": "elementID", "type": "elementID", "label": "elementID", "value": "elementID"});7driver.executeScript("mobile: submit", {"element": "elementID", "id": "elementID", "name": "elementID", "type": "elementID", "label": "elementID", "value": "elementID", "enabled": "elementID"});8driver.executeScript("mobile: submit", {"element": "elementID", "id": "elementID", "name": "elementID", "type": "element

Full Screen

Using AI Code Generation

copy

Full Screen

1const wdio = require('webdriverio');2const assert = require('assert');3const opts = {4 capabilities: {5 }6};7(async () => {8 const browser = await wdio.remote(opts);9 const form = await browser.$('form');10 const status = await form.submit();11 assert.equal(status, 200);12 await browser.deleteSession();13})();14const wdio = require('webdriverio');15const assert = require('assert');16const opts = {17 capabilities: {

Full Screen

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Appium Xcuitest Driver automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Sign up Free
_

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful