var _____WB$wombat$assign$function_____ = function(name) {return (self._wb_wombat && self._wb_wombat.local_init && self._wb_wombat.local_init(name)) || self[name]; }; if (!self.__WB_pmw) { self.__WB_pmw = function(obj) { this.__WB_source = obj; return this; } } { let window = _____WB$wombat$assign$function_____("window"); let self = _____WB$wombat$assign$function_____("self"); let document = _____WB$wombat$assign$function_____("document"); let location = _____WB$wombat$assign$function_____("location"); //let top = _____WB$wombat$assign$function_____("top"); let parent = _____WB$wombat$assign$function_____("parent"); let frames = _____WB$wombat$assign$function_____("frames"); let opener = _____WB$wombat$assign$function_____("opener"); (function ($, window, document, undefined) { var pluginName = "frontLetters"; function FrontLetters(element, options) { this.element = $(element); this.settings = $.extend({ timing: 100, // время прохождения ленты от края до края pause: 5, // задержка анимации ленты scrollTiming: 100, // время (ms) прохождения шага скроллинга колёсиком scrollSpacing: 160, // шаг скроллинга колёсиком (px) mobW: 600, // ширина, меньше которой показываем вариант для мобильных устройств tabW: 1040 // для ширины больше mobW и меньше tabW показываем версию для планшетов }, options); this.init(); } $.extend(FrontLetters.prototype, { lenta: null, timer: null, starter: true, setup: { popup: '.letter-popup', type: 'linear', side: 'left', pause: false, timing: false, spacing: false, scrollSpacing: false, scrollTiming: false, animationPermitted: false, // на мобильной версии анимацию ленты отключаем cookies: null, cookiesData: [] // распарсенные куки }, init: function () { var self = this; self.lenta = self.element; self.lenta.show(); //$('.loading').hide(); self.setup = $.extend(self.setup, self.settings); self.setup.timing = self.setup.timing * 1000; self.setup.pause = self.setup.pause * 1000; self.bind(); self.popupEvents(); var key = '#letter'; self.resize(); self.setup.cookies = ($.cookie('letters_seen')) ? $.cookie('letters_seen') : 'null'; self.setup.cookiesData = ($.cookie('letters_seen')) ? JSON.parse(self.setup.cookies) : []; self.seen(); window.lenta = this; var winW = $(window).outerWidth(); if(winW > self.setup.tabW){ self.setup.animationPermitted = true; self.moveLeft(); } return true; }, seen: function () { var self = this; for (var i=0; i < self.setup.cookiesData.length; i++) { var lid = self.setup.cookiesData[i].replace('letters.php#letter', '#l'); $(lid).addClass('seen'); } }, /** B I N D S **/ bind: function () { var self = this; $('body').on('click', '.letter-inner > a', function(e){ e.preventDefault(); $(this).parents('.letter').addClass('seen'); var letterId = $(this).attr('href'); if (self.setup.cookiesData.indexOf(letterId) === -1) { self.setup.cookiesData.push(letterId); } self.setup.cookies = JSON.stringify(self.setup.cookiesData); $.cookie('letters_seen', self.setup.cookies); window.location = letterId; }); $('body').on('mouseenter', '.letter', function () { var winW = $(window).outerWidth(); if(winW > self.setup.tabW) { clearTimeout(self.timer); self.animateStop(); self.timerStart(); } }); $('body').on('mouseenter', '.letter-inner', function(){ var winW = $(window).outerWidth(); if(winW > self.setup.tabW){ $(this).find('.sender').stop(true, false).slideDown().delay(5000).slideUp(); } }).on('mouseleave', '.letter-inner', function(){ $(this).find('.sender').stop(true, false).slideUp(); }); self.lenta.mousewheel(function (event, delta) { var winW = $(window).outerWidth(); if(winW > self.setup.mobW) { var action = ( delta > 0 ) ? 'scrollLeft' : 'scrollRight'; self.animateStop(); self[ action ](); event.preventDefault(); } }); self.lenta.swipe( { swipe:function(event, direction, distance, duration, fingerCount, fingerData) { var winW = $(window).outerWidth(); if(winW > self.setup.mobW) { var action; if (direction == 'left' ) { action = 'swipeLeft'; } else if (direction == 'right' ) { action = 'swipeRight'; } self.animateStop(); self[ action ](distance, duration); event.preventDefault(); } else { return false; } }, allowPageScroll:'vertical' }); $('.table-content-list-inner-wrapper').mCustomScrollbar({ theme:"my-theme", scrollbarPosition: "outside", autoHideScrollbar: true, scrollInertia: 0 }); $(window).resize(function () { self.resize(); }); $('body').on('click', '.table-content-list tr', function(){ window.location = 'letters.php' + $(this).attr('data-url'); }); }, popupEvents: function () { var self = this; overlay = $('.screen-overlay'); $('body').on('click', '.contents-link', function(){ var winW = $(window).outerWidth(); overlay.show(); if(winW <= self.setup.mobW) { $('.table-content-popup').slideDown(); } else { $('.table-content-popup').show(); } }); $('body').on('click', '.about-link', function(e){ e.preventDefault(); var winW = $(window).outerWidth(); overlay.show(); if(winW <= self.setup.mobW) { $('.about-popup').slideDown(); } else { $('.about-popup').show(); } }); $('body').on('click', '.close-popup, .close-btn, .screen-overlay', function(){ var winW = $(window).outerWidth(), popup = $('.popup:visible'); if(winW <= self.setup.mobW) { if (popup.hasClass('about-popup')) { popup.slideUp(); } else { popup.slideUp(function(){ $(this).remove(); }); } } else { if (popup.hasClass('about-popup')) { popup.hide(); } else { popup.hide().remove(); } } overlay.hide(); }); }, /** M O V E **/ moveLeft: function () { var self = this; var side = 'left', time = self.getTime(), point = self.setup.spacing, backup = true; self.move(side, time, point, backup, self.setup.type); }, moveRight: function () { var self = this; var side = 'right', time = self.getTime(), point = 0, backup = true; self.move(side, time, point, backup, self.setup.type); }, scrollLeft: function () { var self = this; var side = 'left', time = self.setup.scrollTiming, point = self.scrollPoint(side), backup = false; self.move(side, time, point, backup, self.setup.type); }, scrollRight: function () { var self = this; var side = 'right', time = self.setup.scrollTiming, point = self.scrollPoint(side), backup = false; self.move(side, time, point, backup, self.setup.type); }, swipeLeft: function(distance, duration) { var self = this, side = 'right', swipeShift = distance, point = self.swipePoint(side, swipeShift), backup = false, type = 'swing'; self.move(side, duration, point, backup, type); }, swipeRight: function(distance, duration) { var self = this, side = 'left', swipeShift = distance, point = self.swipePoint(side, swipeShift), backup = false, type = 'swing'; self.move(side, duration, point, backup, type); }, move: function (side, time, point, backup, type) { var self = this; var winW = $(window).outerWidth(); if (backup === true) self.setup.side = side; if (self.lenta.is(':animated')) self.lenta.stop(); $('.lenta').animate({ left: point }, time, type, function () { // если backup == false (получаем в случае scrollLeft & scrollRight ) то по окончании запускаем таймер var action = 'timerStart'; if (backup) { // если backup == true (получаем в случае moveLeft & moveRight ) то по окончании анимации проигрываем анимацию в обратную сторону action = ( side == 'right' ) ? 'moveLeft' : 'moveRight'; } if(winW >= self.setup.tabW) { self[ action ](); } }); }, /** T O O L S **/ animateStop: function () { var self = this; self.lenta.stop(); clearTimeout(self.timer); }, timerStart: function () { var self = this; if (self.starter) { self.timer = setTimeout(function () { var action = ( self.setup.side == 'left' ) ? 'moveLeft' : 'moveRight'; self[ action ](); }, self.setup.pause); } }, getTime: function () { var self = this, time = self.setup.timing; var v = self.setup.spacing / time * -1, // скорость движения ленты (px/ms) s = ( self.lenta.css('left') ) ? self.lenta.css('left').replace('px', '') * -1 : false, //смещение ленты (расстояние, уже пройденное от исходной позиции t = ( s !== false ) ? Math.round(time - (s / v)) : false; // оставшееся время движения до края ленты var resp = ( t !== false ) ? ( time * ( t / time ) ) : false; if (self.setup.side == 'right') resp = time - ( time * ( t / time ) ); if (!resp) resp = self.setup.timing; return resp; // результирующее время движения ленты до края }, scrollPoint: function (side) { var self = this, resp, coords = self.lenta.offset().left; switch (side) { case 'left': resp = coords + self.setup.scrollSpacing; if (resp > 0) resp = 0; break; case 'right': resp = coords - self.setup.scrollSpacing; if (resp < self.setup.spacing) resp = self.setup.spacing; break; } return resp; // координата, к которой будет совершено смещение в результате скролла }, swipePoint: function (side, swipeShift) { var self = this, resp, coords = self.lenta.offset().left; switch (side) { case 'left': resp = coords + swipeShift; if (resp > 0) resp = 0; break; case 'right': resp = coords - swipeShift; if (resp < self.setup.spacing) resp = self.setup.spacing; break; } return resp; // координата, к которой будет совершено смещение в результате свайпа }, resize: function () { var self = this, item = self.lenta; var winW = $(window).outerWidth(), lineW = 0; if (winW > self.setup.mobW) { self.animateStop(); if (winW > self.setup.tabW){ self.timerStart(); } if (!self.setup.animationPermitted) { self.setup.animationPermitted = true; self.timerStart(); } $('.lenta').find('.letter-bg').each(function (index, img) { img = $(img); var imgWidth = img.css('width'); img.parent().css('width', imgWidth); }); $('.line1').children().each(function(){ lineW = lineW + $(this).outerWidth(); }); item.width(lineW).children(".line").width(lineW + 1); } else { if (self.setup.animationPermitted) { self.setup.animationPermitted = false; //clearTimeout(self.timer); self.animateStop(); } item.width('auto').css('left', 0).children('.line').width('auto'); $('.letter-inner > a').width('auto'); } if ((winW > self.setup.mobW) && (winW <= self.setup.tabW)) { clearTimeout(self.timer); self.animateStop(); if (self.setup.animationPermitted) { self.setup.animationPermitted = false; } } self.setup.spacing = 0 - lineW + $('body').width(); } }); $.fn[ pluginName ] = function (options) { this.each(function () { if (!$.data(this, "plugin_" + pluginName)) { $.data(this, "plugin_" + pluginName, new FrontLetters(this, options)); } }); return this; }; })(jQuery, window, document); } /* FILE ARCHIVED ON 16:21:59 Jan 19, 2020 AND RETRIEVED FROM THE INTERNET ARCHIVE ON 10:33:45 Nov 16, 2024. JAVASCRIPT APPENDED BY WAYBACK MACHINE, COPYRIGHT INTERNET ARCHIVE. ALL OTHER CONTENT MAY ALSO BE PROTECTED BY COPYRIGHT (17 U.S.C. SECTION 108(a)(3)). */ /* playback timings (ms): captures_list: 0.334 exclusion.robots: 0.01 exclusion.robots.policy: 0.005 esindex: 0.006 cdx.remote: 81.596 LoadShardBlock: 84.542 (3) PetaboxLoader3.datanode: 93.679 (4) load_resource: 91.661 PetaboxLoader3.resolve: 43.812 */