1(function($) { 2 Drupal.behaviors.deals = { 3 attach: function(context, settings) { 4 //deals for home page 5 $('.region-topeight-phones .headers h2').click(function() { 6 if ($(this).hasClass('disabled')) { 7 $(this).removeClass('disabled').siblings('h2').addClass('disabled'); 8 if ($('#block-views-fmtc-deals-all-deals .content').is(":visible")) { 9 $('#block-views-fmtc-deals-all-deals .content').hide(); 10 $('#block-views-phones-top-eight-phones .content').show(); 11 } else { 12 $('#block-views-phones-top-eight-phones .content').hide(); 13 $('#block-views-fmtc-deals-all-deals .content').show(); 14 } 15 } 16 }); 17 //deals textbox search 18 var typingTimer; //timer identifier 19 var doneTypingInterval = 2000; //time in ms, 2 second 20 $('#edit-submit-fmtc-deals').hide(); 21 //on keyup, start the countdown 22 $('#edit-deal').bind('keyup', function(){ 23 clearTimeout(typingTimer); 24 typingTimer = setTimeout(doneTyping, doneTypingInterval); 25 }); 26 $("input[type='checkbox'][name='merchantid[]']").change(function() { 27 $('#edit-submit-fmtc-deals').trigger("click"); 28 }); 29 function doneTyping () { 30 $('#edit-submit-fmtc-deals').trigger("click") 31 } 32 function SetCaretAtEnd(elem) { 33 var elemLen = elem.value.length; 34 // For IE Only 35 if (document.selection) { 36 // Set focus 37 elem.focus(); 38 // Use IE Ranges 39 var oSel = document.selection.createRange(); 40 // Reset position to 0 & then set at end 41 oSel.moveStart('character', -elemLen); 42 oSel.moveStart('character', elemLen); 43 oSel.moveEnd('character', 0); 44 oSel.select(); 45 } 46 else if (elem.selectionStart || elem.selectionStart == '0') { 47 // Firefox/Chrome 48 elem.selectionStart = elemLen; 49 elem.selectionEnd = elemLen; 50 elem.focus(); 51 } // if 52 } // SetCaretAtEnd() 53 //deals text field add focus after ajax 54 var textboxToFocus = {}; 55 jQuery(function($) { 56 var addFocusReminder = function(textbox) { 57 textbox.bind('keypress keyup', function(e) { 58 textboxToFocus.formid = $(this).closest('form').attr('id'); 59 textboxToFocus.name = $(this).attr('name'); 60 61 if(e.type == 'keypress') { 62 if(e.keyCode != 8) { // everything except return 63 textboxToFocus.value = $(this).val() + String.fromCharCode(e.charCode); 64 } else { 65 textboxToFocus.value = $(this).val().substr(0, $(this).val().length-1) 66 } 67 } 68 else { // keyup 69 textboxToFocus.value = $(this).val(); 70 } 71 }); 72 } 73 addFocusReminder($('#edit-deal')); 74 $(document).ajaxComplete(function(event,request, settings) { 75 if(typeof textboxToFocus.formid !== 'undefined') { 76 var textBox = $('#' + textboxToFocus.formid + ' input:text[name="' + textboxToFocus.name + '"]'); 77 textBox.val(textboxToFocus.value); 78 SetCaretAtEnd(textBox[0]); 79 addFocusReminder(textBox); 80 } 81 }); 82 }); 83 //phonetool page deals show/hide 84 var phoneBlock = $('#block-views-phones-phone-tool .view-content'); 85 var dealsBlock = $('#block-views-fmtc-deals-all-deals'); 86 var comparePhoneBlock = $('.compare-phones-ecommerce'); 87 $('#block-views-phones-phone-tool .features, #block-views-phones-phone-tool .brand, #block-views-phones-phone-tool .other').click(function() { 88 phoneBlock.show(); 89 comparePhoneBlock.show(); 90 $('#block-views-fmtc-deals-all-deals').hide(); 91 $('.all-deals').removeClass('ui-state-active'); 92 }); 93 $('#block-views-phones-phone-tool .all-deals').click(function() { 94 dealsBlock.show(); 95 phoneBlock.hide(); 96 comparePhoneBlock.hide(); 97 }); 98 $(window).on('load resize', function() { 99 if(phoneBlock.is(":visible")) { 100 dealsBlock.hide(); 101 } 102 }); 103 // plantool deals tab 104 var plansBlock = $('#block-views-plans-plan-tool .view-content'); 105 var dealsBlock = $('#block-views-fmtc-deals-all-deals'); 106 var planDealsBlock = $('.node-type-phone-plan #deals'); 107 $(window).on('load resize', function() { 108 if (plansBlock.is(":visible")) { 109 dealsBlock.hide(); 110 planDealsBlock.hide(); 111 } 112 }); 113 $('#block-views-plans-plan-tool .sort.popular, #block-views-plans-plan-tool .sort.price, #block-views-plans-plan-tool .sort.minutes, #block-views-plans-plan-tool .sort.data, #plans-and-specs .plans, #plans-and-specs .unlocked, #plans-and-specs .media, #plans-and-specs .reviews').click(function() { 114 plansBlock.show(); 115 $('#block-views-fmtc-deals-all-deals').hide(); 116 $('.deals').removeClass('ui-state-active'); 117 }); 118 $('#block-views-plans-plan-tool .sort.deals').click(function() { 119 dealsBlock.show(); 120 plansBlock.hide(); 121 }); 122 //plan & phone billboard page see all deals button
123 $('.node-type-phone-plan .see-all-deals').click(function() { 124 var tab = $(this).attr('href'); 125 var index = $('#planTabs ul').index($('#'+tab)); 126 $('#planTabs').tabs('option','active',index); 127 }); 128 $('.node-type-phone .see-all-deals').click(function() { 129 var index = $('#plans-and-specs ul').index($('#block-views-fmtc-deals-phone-fmtc-deal')); 130 $('#plans-and-specs').tabs('option','active',index); 131 $('html, body').animate({ 132 scrollTop: $(".deals").offset().top 133 }, 1000); 134 }); 135 136 } 137 }; 138})(jQuery); 139 140(function($) { 141if ($('.region-topeight-phones .headers h2').hasClass('disabled')) { 142 $('.deals').removeClass('disabled'); 143 $('.smartphones1').addClass('disabled'); 144 if ($('#block-views-fmtc-deals-all-deals .content').is(":visible")) { 145 $('#block-views-fmtc-deals-all-deals .content').hide(); 146 $('#block-views-phones-top-eight-phones .content').show(); 147 } else { 148 $('#block-views-phones-top-eight-phones .content').hide(); 149 $('#block-views-fmtc-deals-all-deals .content').show(); 150 } 151 } 152 })(jQuery); 153;/*})'"*/ 154;/*})'"*/
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.