1(function () { 2 var window = this, 3 $ = window.jQuery, 4 DDC = (window.DDC = (window.DDC || {})); 5 6 DDC.modules.directionsForm.refresh = function () { 7 $(DDC.modules.directionsForm.selector).each(function () { 8 if (!$(this).data('directions-form-initialized')) { 9 var selectedAccount = $('[name="destinationAddress"] option:selected', this).text(); 10 11 $('[name="destinationAddress"]',this).bind('change', function () { 12 selectedAccount = $('option:selected', this).text(); 13 $('li .vcard').each(function(){ 14 var org = $(this).find('.org').text(), 15 re = new RegExp('^(' + selectedAccount + ')$', 'gi'); 16 org.match(re) && $(this).parent().trigger('mouseenter'); 17 }); 18 }); 19 20 21 $(this).bind('submit', function (ev) { 22 var form = $(this), 23 $directionsFormWrapper = form.closest('.directions-form'), 24 fields = { 25 array: form.serializeArray() 26 }, 27 $formEvent = [], 28 o; 29 30 if (!form.data('validator') || form.data('validator').checkValidity()) { 31 for (o in fields.array) { 32 if (fields.array.hasOwnProperty(o) && fields.array[o].name) { 33 fields[fields.array[o].name] = fields.array[o].value; 34 } 35 } 36 37 if (!fields.startAddress && fields.strt1 && fields.zipc1) { 38 fields.startAddress = [fields.strt1, fields.zipc1].join(', '); 39 } 40 41 if (fields.startAddress && fields.destinationAddress) { 42 43 // link for clearing directions 44 var icon = document.createElement('span'); 45 icon.setAttribute ('class', 'align-right ui-icon ui-icon-circle-close'); 46 var resetLink = document.createElement('a'); 47 resetLink.appendChild (icon); 48 resetLink.setAttribute ('href', '#'); 49 resetLink.setAttribute ('class', 'reset-link'); 50 51 // remove old vcard if it is on page already 52 $directionsFormWrapper.find('div .vcard').parent().remove(); 53 54 // swap out drop down with vcard area with 'x' button 55 var vCard = $('li .vcard:contains("' + selectedAccount + '")').parent().html(); 56 var vCardDiv = document.createElement('div'); 57 vCardDiv.setAttribute('class', 'ddc-content mod'); 58 $(vCardDiv).html(resetLink); 59 $(vCardDiv).append(vCard); 60 $(this).prepend(vCardDiv); 61 //$('[name="destinationAddress"]',this).parent().hide('slow'); 62 63 $(resetLink) 64 .bind('click', function() { 65 $(this).closest('form').find(':input') 66 .not(':button, :submit, :reset, :hidden') 67 .val('') 68 .removeAttr('checked') 69 .removeAttr('selected'); 70 71 $directionsFormWrapper.find('form').find('label:hidden,.yui3-u-1').show('fast'); 72 $(this).parent().remove(); 73 74 $(document).trigger('directions-reset', ev); 75 }); 76 77 $(document).trigger('directions-search', { 78 directions: { 79 destination: fields.destinationAddress, 80 origin: fields.startAddress 81 }, 82 targetMap: $.getDataAttributes(form).targetMap 83 }); 84 85 $formEvent = $directionsFormWrapper.find('[name="formEventId"]'); 86 87 window.DDC.pushToPixall({ 88 type: 'event', 89 eventType: 'formSubmission', 90 formType: 'directions', 91 formEventId: ($formEvent.length > 0) ? $formEvent.val() : '' 92 }, { 93 source: 'cms-web', 94 sourceFile: 'htdocs/v9/media/js/ddc/v1/modules/directionsform.js:87' 95 }); 96 } 97 } 98 99 return false; 100 }).data('directions-form-initialized', true); 101 } 102 }); 103 }; 104}()); 105
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.