1var scc_jquery = jQuery; 2jQuery.noConflict(true); 3 4function showError ( message ) { 5 if( ! message ) { 6 scc_jquery("#scs_cartmessages").css('display','none') ; 7 } else { 8 scc_jquery("#scs_cartmessages_content").html( message ); 9 scc_jquery("#scs_cartmessages").css('display','block') ; 10 11 // Animates to ensure the visibility of the error message 12 scc_jquery('html, body').animate( {scrollTop: scc_jquery("#scs_cartmessages").offset().top - 10 }, 500); 13 14 } 15} 16 17// Returns the version of Internet Explorer or a -1 (indicating the use of another browser). 18function getInternetExplorerVersion() 19{ 20 var rv = -1; // Return value assumes failure. 21 if (navigator.appName == 'Microsoft Internet Explorer') 22 { 23 var ua = navigator.userAgent; 24 var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})"); 25 if (re.exec(ua) != null) 26 rv = parseFloat( RegExp.$1 ); 27 } 28 return rv; 29} 30 31 32function checkIE6Version() 33{ 34 var ver = getInternetExplorerVersion(); 35 36 if ( ver > -1 ) 37 { 38 if ( ver < 7.0 ) 39 { 40 return true; 41 } 42 } 43 return false; 44} 45 46// Show the visual hint for the user to wait for the ajax to be finished 47function show_spinner(){ 48 scc_jquery('img#ajax_waiting_spinner').css('display', 'block'); 49} 50 51// Hides the visual hint once the ajax query has been processed 52function hide_spinner(){ 53 scc_jquery('img#ajax_waiting_spinner').css('display', 'none'); 54} 55 56function updateCartValues ( ) { 57 58 // clone the form data and add the format=json 59 var fc = scc_jquery("form.cart").clone( true ); 60 scc_jquery( "#extrashipid", fc ).val( scc_jquery("#extrashipid").val() ) 61 scc_jquery( "#taxlocid", fc ).val( scc_jquery("#taxlocid").val() ) 62 fc.append('<input type="hidden" name="format" value="json">') 63 .append('<input type="hidden" name="method" value="update">'); 64 65 // Shows the spinner as visual hint to the user that something is being processed. 66 show_spinner(); 67 68 // do the async request and update the fields 69 scc_jquery.post( scc_jquery("form.cart").attr("action"), 70 fc.serialize(), 71 function( data ) { 72 // update the cart 73 showError( data.message ); 74 scc_jquery("#cart_total").html( data.currencysymbol + data.total ); 75 scc_jquery("#cart_subtotal").html( data.currencysymbol + data.subtotal ) 76 scc_jquery("#cart_shipping_total").html( data.currencysymbol + data.shippingtotal ) 77 78 // Hides the taxes in case they are empty 79 if( data.taxes == '0.00' ) { 80 scc_jquery("#cart_taxes_total_label").html( '' ) 81 scc_jquery("#cart_taxes_total").html( '' ) 82 } else { 83 scc_jquery("#cart_taxes_total_label").html( 'Estimated Taxes:' ) 84 scc_jquery("#cart_taxes_total").html( data.currencysymbol + data.taxes ) 85 } 86 87 for( var li in data.lineitems ) { 88 var sel = "#product_subtotal_" + data.lineitems[li].cid; 89 scc_jquery( sel ).html( data.currencysymbol + data.lineitems[li].subtotal ) 90 } 91 92 // Hides the spinner as visual hint to the user that something is being processed. 93 hide_spinner(); 94 }, 95 "json" ); 96} 97 98 99// for the cart and product pages 100scc_jquery(document).ready( 101 102 function() { 103 104 // Adds to the dom the spinner element. It will be hided until an ajax request is handled 105 //scc_jquery(function(){ 106 // var spinner = scc_jquery('<img id="ajax_waiting_spinner" src="ccdata/images/spinner.gif" />'); 107 // spinner.css({ display: 'none', position: 'fixed', top:'50%', left:'50%' }); 108 // scc_jquery('body').append(spinner); 109 //}); 110 111 // get fresh data after changes 112 scc_jquery("#extrashipid, #taxlocid, div.scs_cart_quantity_input_wrapper>input").bind("change", 113 function(e) { updateCartValues(); } 114 ); 115 116 // add some validation on input fields for cart page 117 scc_jquery("form.cart input[type='text']").bind("keyup", 118 function(e) { 119 // validate all input fields 120 var elms = scc_jquery("form.cart input[type='text']"); 121 var valid = true; 122 for( i = 0; i < elms.length; i++ ) { 123 valid = (elms[i].value.search(/[^0-9 ]/) == -1); 124 if( ! valid ) { 125 showError("Only numbers are allowed in the Quantity field(s)."); 126 scc_jquery("form.cart input[type='submit']").attr("disabled","disabled"); 127 break; 128 } 129 } 130 if( valid ) { 131 showError(""); 132 } 133 } 134 ); 135 136 // quantity validation for product page 137 scc_jquery("input[name='quantity']").bind("keyup", 138 function(e) { 139 if( this.value.search(/[^0-9 ]/) != -1) { 140 showError("Only numbers are allowed in a Quantity field."); 141 scc_jquery("input.scs_addtocart[type='submit']").attr("disabled","disabled"); 142 } else { 143 showError(""); 144 scc_jquery("input.scs_addtocart[type='submit']").attr("disabled",""); 145 } 146 } 147 ); 148 149 // Checks if the IE6 is running 150 if( checkIE6Version() ) 151 { 152 scc_jquery("body").prepend("<div id=\"iesix\"><p>Hey! You appear to be using Internet Explorer 6. You really should <a href=\"http://www.coffeecup.com/browserupgrade/\">upgrade to a newer browser</a>, your experience on the Web will be much better.</p></div>"); 153 } 154 155 // Add target blank for browser that don't support 'rel' attribute 156 scc_jquery("a[href][rel=external]").attr('target', '_blank'); 157 158 // Applies colorbox to the images 159 scc_jquery("a.colorbox_scc").colorbox_scc({transition:"elastic", width:"75%", height:"75%"});
160 161 } 162 );
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.