1var ecwShoppingCartActions = function(){ 2 3 var deleteItem = function( row ){ 4 5 var itemsStatuses = jQuery( "ul.subsubsub li" ); 6 var itemCartStatus = row.attr( "class" ); 7 itemCartStatus = itemCartStatus.split( " " ); 8 itemCartStatus = itemCartStatus[ 1 ]; 9 10 jQuery( itemsStatuses ).each( function(){ 11 12 var listClass = jQuery( this ).attr( "class" ); 13 14 if( listClass == itemCartStatus || ( listClass == "all" && itemCartStatus != "trash" ) ){ 15 16 var totalCount = jQuery( this ).find( "span.count" ).text(); 17 totalCount = totalCount.substring( 1, totalCount.length-1 ); 18 totalCount = totalCount - 1; 19 20 jQuery( this ).find( "span.count" ).text( "(" + totalCount + ")" ); 21 22 } 23 24 }); 25 26 row.closest( "tr" ).css( "background", "#F387A2" ).fadeOut( 1500 ); 27 28 }, 29 showLoadingScreen = function(){ 30 31 jQuery( "div.email-cart #email-cart-form input[type=text]" ).removeClass( "error" ); 32 jQuery( "#email-cart-form .form" ).fadeOut( 300, function(){ 33 jQuery( "#email-cart-form .process" ).fadeIn( 300 ); 34 }); 35 jQuery( "div.email-cart div.ui-dialog-titlebar .ui-dialog-title" ).fadeOut( 300 ); 36 jQuery( "div.email-cart #email-cart-form + div.ui-dialog-buttonpane" ).fadeOut( 300 ); 37 38 }, 39 shoppingCartErrorSending = function(){ 40 41 ecwShoppingCartActions.hideMessages(); 42 jQuery( "#email-cart-form .error" ).show(); 43 44 }, 45 shoppingCartSent = function(){ 46 47 ecwShoppingCartActions.hideMessages(); 48 jQuery( "#email-cart-form .success" ).show(); 49 50 }, 51 validateEmailCartForm = function( senderName, recipientName, recipientEmail ){ 52 53 var results = { sendersNameIsEmpty: true, recipientNameIsEmpty: true, emailIsEmpty: true, emailIsValid: false }; 54 55 if( senderName.length !== 0 ){ 56 results.sendersNameIsEmpty = false; 57 } 58 if( recipientName.length !== 0 ){ 59 results.recipientNameIsEmpty = false; 60 } 61 if( recipientEmail.length !== 0 ){ 62 results.emailIsEmpty = false; 63 } 64 if( isValidEmail( recipientEmail ) ){ 65 results.emailIsValid = true; 66 } 67 68 return results; 69 70 }, 71 isValidEmail = function( email ){ 72 73 var emailReg = new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i); 74 var valid = emailReg.test( email ); 75 76 return ( !valid ) ? false : true; 77 78 }, 79 hideMessages = function(){ 80 81 // Reset values 82 jQuery( "div.email-cart #email-cart-form input[type=text]" ).val( "" ); 83 84 // Remove error class 85 jQuery( "div.email-cart #email-cart-form input[type=text]" ).removeClass( "error" ); 86 87 jQuery( "#email-cart-form .process" ).hide(); 88 jQuery( "#email-cart-form .success" ).hide(); 89 jQuery( "#email-cart-form .error" ).hide(); 90 91 }, 92 validateForm = function( validate ){ 93 94 var $cartForm = jQuery( "#email-cart-form .form" ), 95 toastrErrors = [], 96 errorMessageDuration = "1000000"; 97 98 if( validate.sendersNameIsEmpty == true ){ 99 100 $cartForm.find( "#sender_name" ).addClass( "error" ); 101 toastrErrors.push( ecw_email_cart_js_vars.sender_error_msg ); 102 103 }else{ 104 $cartForm.find( "#sender_name" ).removeClass( "error" ); 105 } 106 107 if( validate.recipientNameIsEmpty == true ){ 108 109 $cartForm.find( "#recipient_name" ).addClass( "error" ); 110 toastrErrors.push( ecw_email_cart_js_vars.recipient_error_msg ); 111 112 }else{ 113 $cartForm.find( "#recipient_name" ).removeClass( "error" ); 114 } 115 116 if( validate.emailIsEmpty == true || validate.emailIsValid == false ){ 117 118 $cartForm.find( "#recipient_email" ).addClass( "error" ); 119 toastrErrors.push( ecw_email_cart_js_vars.email_error_msg ); 120 121 }else{ 122 $cartForm.find( "#recipient_email" ).removeClass( "error" ); 123 } 124 125 if ( toastrErrors.length > 0 ) { 126 127 var str = "<ul>"; 128 for ( var i = 0 ; i < toastrErrors.length ; i++ ) { 129 str += "<li>→ " + toastrErrors[ i ] + "</li>"; 130 } 131 str += "</ul>"; 132 133 toastr.error( str , ecw_email_cart_js_vars.general_error_msg , { "closeButton" : true, "showDuration" : errorMessageDuration } ); 134 135 } 136 137 }; 138 139 return { 140 deleteItem : deleteItem, 141 showLoadingScreen : showLoadingScreen, 142 shoppingCartErrorSending : shoppingCartErrorSending, 143 shoppingCartSent : shoppingCartSent, 144 validateEmailCartForm : validateEmailCartForm, 145 isValidEmail : isValidEmail, 146 hideMessages : hideMessages, 147 validateForm : validateForm 148 }; 149 150}();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.