1$('document').ready(function(){ 2 3 // ÐÐ¾Ð»Ñ 4 var cookieNamePrefix = 'franch-unika-'; 5 var cookieExpire = 30; 6 var cookiePath = '/'; 7 8 // ÐагÑÑзка ÑÑÑеÑÑвÑÑÑÐ¸Ñ Ð·Ð½Ð°Ñений кÑки 9 loadCookies(); 10 11 function loadCookies() { 12 // ТекÑÑовÑе инпÑÑÑ 13 $('.cookie-form input, .cookie-form textarea').each(function() { 14 if ($.cookie(cookieNamePrefix + $(this).attr('name')) 15 && !$(this).hasClass('captcha') 16 && $.cookie(cookieNamePrefix + $(this).attr('name')) != 'null' 17 && $(this).attr('type') != 'radio' 18 && $(this).attr('type') != 'submit' 19 && $(this).attr('type') != 'reset') { 20 $(this).val($.cookie(cookieNamePrefix + $(this).attr('name'))); 21 }; 22 }); 23 24 // СелекÑÑ 25 $('.cookie-form select').each(function() { 26 var selectedName = $.cookie(cookieNamePrefix + $(this).attr('name')); 27 28 if (selectedName != 'null') { 29 $(this).find('option').each(function() { 30 if (selectedName === $(this).val()) { 31 $(this).attr('selected', 'selected'); 32 } else { 33 $(this).removeAttr('selected'); 34 }; 35 }); 36 }; 37 38 // ÐÑовеÑка ÑелекÑа СпоÑоба доÑÑавки 39 if( $(this).attr('name') == 'delivery-select' ) { 40 41 $(this).find('option').each(function() { 42 if($(this).attr('selected') == 'selected' && $(this).val() != ''){ 43 var value = $(this).val(); 44 45 // УбиÑаем ÑоÑÐ¼Ñ Ð²Ð²Ð¾Ð´Ð° адÑеÑа 46 if ($('div').is('#address-form-wrapper')) window.addressForm = $('#address-form-wrapper').detach(); 47 48 // ÐÑделÑем ÑооÑвеÑÑÑвÑÑÑий ÑкÑÑÑÑй input 49 $(this).closest('div').find('input').each(function(){ 50 if($(this).attr('value') == value){ 51 $(this).attr('checked', 'checked'); 52 }else{ 53 $(this).removeAttr('checked'); 54 } 55 }); 56 57 } 58 }); 59 } 60 }); 61 62 63 setCookie(); 64 } 65 66 // УÑÑановка кÑки пÑи ÑобÑÑии change 67 function setCookie() { 68 // ТекÑÑовÑе инпÑÑÑ 69 $('.cookie-form input, .cookie-form textarea').change(function() { 70 if ($(this).attr('type')!= 'radio' && $(this).attr('type')!= 'reset' && $(this).attr('type')!= 'submit') { 71 $.cookie(cookieNamePrefix + $(this).attr('name'), $(this).val(), { expires: cookieExpire, path: cookiePath }); 72 console.log(cookieNamePrefix + $(this).attr('name')); 73 }; 74 }); 75 76 // СелекÑÑ 77 $('.cookie-form select').change(function() { 78 $.cookie(cookieNamePrefix + $(this).attr('name'), $(this).val(), { expires: cookieExpire, path: cookiePath }); 79 console.log(cookieNamePrefix + $(this).attr('name')); 80 }); 81 } 82 83 // СбÑÐ¾Ñ ÐºÑки ÑелекÑа пÑи изменении ÑпоÑоба доÑÑавки 84 $('.cookie-form input:radio').change(function() { 85 if($(this).attr('name') == 'delivery-id' && $(this).attr('data-type') != 'self') $.cookie('franch-unika-delivery-select', null, { path: cookiePath }); 86 }); 87 88 // СбÑÐ¾Ñ Ð·Ð½Ð°Ñений кÑки 89 $(':reset').click(function() { 90 if (confirm("ÐÑ Ð¿Ð¾Ð´ÑвеÑждаеÑе оÑиÑÑÐºÑ ÑоÑмÑ?")) { 91 cookieCleaner(); 92 } 93 }); 94 95 function cookieCleaner() { 96 var i = 0; 97 $('.cookie-form input, .cookie-form textarea').each(function() { 98 if($(this).attr('type') != 'submit' && $(this).attr('type') != 'reset') { 99 console.log(i++) 100 $.removeCookie(cookieNamePrefix + $(this).attr('name'), { path: cookiePath }); 101 $(this).val(''); 102 } 103 }); 104 105 106 $('.cookie-form select').each(function() { 107 // if($(this).attr('name').search('data') != -1) { 108 console.log(i++) 109 $.cookie(cookieNamePrefix + $(this).attr('name'), null, { path: cookiePath }); 110 // } 111 }); 112 } 113 114});
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.