1 2// Remap $ to jquery 3(function ($) { 4 5 Drupal.behaviors.wb_cart = { 6 attach: function (context, settings) { 7 //wb_shopping_basket(); 8 //wb_address_tweaks(); 9 wb_order_tweaks(); 10 } 11 }; 12 13 //Fix push enter on de edit-coupon-code 14 $( function() 15 { 16 var $editCouponCodeInput = jQuery('#edit-coupon-code'); 17 if($editCouponCodeInput.length == 0) 18 return; 19 20 $editCouponCodeInput.off('keydown'); 21 $editCouponCodeInput.off('keyup'); 22 $editCouponCodeInput.off('keypress'); 23 24 $editCouponCodeInput.keypress (function(event) 25 { 26 if(event.keyCode == 13) 27 { 28 event.preventDefault(); 29 event.stopPropagation(); 30 } 31 32 33 }); 34 $editCouponCodeInput.keyup (function(event) 35 { 36 if(event.keyCode == 13) 37 { 38 event.preventDefault(); 39 event.stopPropagation(); 40 } 41 42 }); 43 $editCouponCodeInput.keydown (function(event) 44 { 45 if(event.keyCode == 13) 46 { 47 event.preventDefault(); 48 event.stopPropagation(); 49 $('#edit-coupon-add').click(); 50 } 51 52 53 }); 54 55 56 }); 57 58 59 60function wb_shopping_basket(){ 61 $('#block-commerce-cart-cart .block__content').css('display','none'); 62 $('#block-commerce-cart-cart .block__title').css('cursor', 'pointer'); 63 64 65 $('#block-commerce-cart-cart .block__title').click(function(){ 66 $('#block-commerce-cart-cart .block__content') .slideToggle(); 67 }); 68 69 $('#block-commerce-cart-cart a.close').click(function(){ 70 $('#block-commerce-cart-cart .block__content') .slideToggle(); 71 return false; 72 }) 73} 74 75function wb_address_tweaks(){ 76 77 //add new shipping info 78 $('.customer_profile_shipping .add-address').click(function(){ 79 $('.form-item-customer-profile-shipping-addressbook select').val('none').change(); 80 $('body').addClass('shipping-form-enabled'); 81 return false; 82 }); 83 84 85 //add new billing info 86 $('.customer_profile_billing .add-address').click(function(){ 87 $('.form-item-customer-profile-billing-addressbook select').val('none').change(); 88 $('body').addClass('billing-form-enabled'); 89 return false; 90 }); 91 92 //hide those links when there are no adresses 93 if(!$('.form-item-customer-profile-shipping-addressbook').length){ 94 $('.customer_profile_shipping .add-address').css('display','none'); 95 } 96 97 if(!$('.form-item-customer-profile-billing-addressbook').length){ 98 $('.customer_profile_billing .add-address').css('display','none'); 99 } 100 101} 102 103function wb_order_tweaks(){ 104 $('.view-id-commerce_user_orders h2').each(function(){ 105 var text = $(this).text(); 106 $(this).text(text); 107 }) 108 109} 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132})(jQuery); 133 134 135 136
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.