1/** 2 * Date: 12.04.13 3 * Last update: 18.04.13 - Ðобавлена ÑÑнкÑÐ¸Ñ light_switch. 4 * Last update: 18.04.16 - Ðобавлена поддеÑжка cookies Ð´Ð»Ñ ÑемÑ. 5 */ 6 7// ÐеÑеклÑÑение ÑÐµÐ¼Ñ (ÑвеÑлаÑ/ÑемнаÑ) 8function light_switch() { 9 const body = $('body'); 10 const logoImg = $('.header__logo > a > img'); 11 const logoPath = logoImg.attr('src').replace(/logo_(light|black)\.png$/, ''); 12 const themeBtn = $('#header__chek__btn'); 13 const currentTheme = body.attr('id'); 14 15 if (currentTheme === "light") { 16 body.attr('id', 'black'); 17 logoImg.attr('src', `${logoPath}logo_black.png`); 18 themeBtn.removeClass().addClass('header__chek-black'); 19 Cookies.set('tpl', 'black', { expires: 333 }); // ÐÑполÑзÑем библиоÑÐµÐºÑ js-cookie 20 } else { 21 body.attr('id', 'light'); 22 logoImg.attr('src', `${logoPath}logo_light.png`); 23 themeBtn.removeClass().addClass('header__chek-light'); 24 Cookies.set('tpl', 'light', { expires: 333 }); // ÐÑполÑзÑем библиоÑÐµÐºÑ js-cookie 25 } 26} 27 28// ÐенеÑаÑÐ¸Ñ Ñведомлений 29function notyGenerate(type, text) { 30 if (typeof noty !== 'undefined') { 31 noty({ 32 text: text, 33 type: type, 34 dismissQueue: true, 35 layout: 'topRight', 36 theme: 'defaultTheme' 37 }); 38 } else { 39 console.error('ÐиблиоÑека noty не подклÑÑена.'); 40 } 41} 42 43// ÐалидаÑÐ¸Ñ ÑоÑÐ¼Ñ 44function chekForm() { 45 const emailInput = $('[name="field_email"]'); 46 const nameInput = $('[name="field_name_first"]'); 47 const emailValue = emailInput.val().trim(); 48 const nameValue = nameInput.val().trim(); 49 const emailRegex = /\S+@\S+\.\S+/; 50 51 setTimeout(() => $.noty.closeAll(), 2600); 52 53 if (!nameValue) { 54 notyGenerate('error', 'ÐведиÑе ваÑе имÑ'); 55 return false; 56 } 57 if (!emailValue) { 58 notyGenerate('error', 'ÐведиÑе Ð²Ð°Ñ e-mail'); 59 return false; 60 } 61 if (!emailRegex.test(emailValue)) { 62 notyGenerate('error', 'E-mail введен непÑавилÑно'); 63 return false; 64 } 65 return true; 66} 67 68// ÐÑокÑÑÑка ÑÑÑаниÑÑ Ð²Ð²ÐµÑÑ 69function scrollTop() { 70 const scrollBtn = $('.scroll__top__btn'); 71 72 $(window).scroll(function () { 73 if ($(this).scrollTop() > 100) { 74 scrollBtn.fadeIn(500); 75 } else { 76 scrollBtn.fadeOut(500); 77 } 78 }); 79 80 scrollBtn.on('click', function () { 81 $("html, body").animate({ scrollTop: 0 }, 600); 82 return false; 83 }); 84} 85 86// ÐниÑиализаÑÐ¸Ñ Ð¿Ñи загÑÑзке ÑÑÑаниÑÑ 87$(document).ready(function () { 88 // ÐÑедзагÑÑзка изобÑажений 89 $.preloadImages = function () { 90 for (let i = 0; i < arguments.length; i++) { 91 $("<img>").attr("src", arguments[i]); 92 } 93 }; 94 $.preloadImages("/wp-content/themes/odmage/img/logo_black.png", "/wp-content/themes/odmage/img/logo_light.png"); 95 96 // ÐниÑиализаÑÐ¸Ñ ÑÑнкÑий 97 scrollTop(); 98 $('.post__line').last().hide(); 99 $('.sb__block__text #searchsubmit').addClass('btn'); 100 101 // ÐÑовеÑка ÑÐµÐ¼Ñ Ð¸Ð· cookies 102 const savedTheme = Cookies.get('tpl'); 103 if (typeof savedTheme === "undefined") { 104 light_switch(); 105 } 106});
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.