3 let button = $('.js-menu');
4 let menu = $('.l-navigation');
5 let menuLinks = menu.find('a');
7 button.on('click', function() {
8 if(!$(this).hasClass('is-active')) {
9 $(this).addClass('is-active');
10 menu.addClass('is-open');
11 $('body').addClass('is-open');
12 button.find('.bar').addClass('animate');
13 menuLinks.attr('tabindex', 0);
15 $(this).removeClass('is-active');
16 menu.removeClass('is-open');
17 $('body').removeClass('is-open');
18 button.find('.bar').removeClass('animate');
19 menuLinks.attr('tabindex', -1);
23 $(document).keyup(function(e) {
24 if (e.keyCode === 27) {
25 button.removeClass('is-active');
26 menu.removeClass('is-open');
27 $('body').removeClass('is-open');
28 button.find('.bar').removeClass('animate');
29 menuLinks.attr('tabindex', -1);
36 let button = $('.l-navigation__actions .user');
37 let menu = $('#user-menu');
38 let menuLinks = menu.find('a');
40 button.on('click', function() {
41 if (!menu.hasClass('is-open')) {
42 menu.addClass('is-open');
43 menuLinks.attr('tabindex', 0);
45 menu.removeClass('is-open');
46 menuLinks.attr('tabindex', -1)
51 $(document).keyup(function(e) {
52 if (e.keyCode === 27) {
53 menu.removeClass('is-open');
54 menuLinks.attr('tabindex', -1);
58 $(document).click(function() {
59 menu.removeClass('is-open');
60 menuLinks.attr('tabindex', -1);
65 // Ebook/Audiobook Btns
67 let button = $('.c-media__btn button:not(.l-button--media--full)');
68 let popupLayer = $('.c-media__popup');
69 let closeButton = $('.c-media__popup__close');
70 let playButton = $('.c-player__btn--md');
71 let chaptersButton = $('.c-player__chapters span');
72 let select = $('.c-select');
73 let selectItem = $('.c-select li');
74 let volumeButton = $('.icon-volume');
76 button.on('click', function () {
77 let target = $(this).attr('id');
78 $('[data-popup=' + target).addClass('is-open');
79 $('body').addClass('popup-open');
82 closeButton.on('click', function() {
83 $(this).closest('.c-media__popup').removeClass('is-open');
84 $('body').removeClass('popup-open');
87 popupLayer.on('click', function(e) {
89 if($(e.target).is(popupLayer)) {
90 _this.removeClass('is-open');
91 $('body').removeClass('popup-open');
95 chaptersButton.on('click', function() {
96 $(this).parent().toggleClass('is-active');
99 select.on('click', function() {
100 $(this).toggleClass('is-active');
103 selectItem.on('click', function() {
104 selectItem.removeClass('is-active');
105 $(this).addClass('is-active');
108 $(document).keyup(function(e) {
109 if (e.keyCode === 27) {
110 $('.c-media__popup').removeClass('is-open');
115 // Homepage books sliders
117 let shelfSlider = $('.l-your-books__shelf .l-books');
118 let shelfNextSlide = $('.l-your-books__shelf .js-next-slide');
119 let shelfPrevSlide = $('.l-your-books__shelf .js-prev-slide');
120 let shelfCollapse = $('.l-your-books__shelf .js-collapse');
140 shelfNextSlide.on('click', function (event) {
141 event.preventDefault();
142 shelfSlider.slick('slickNext');
145 shelfPrevSlide.on('click', function (event) {
146 event.preventDefault();
147 shelfSlider.slick('slickPrev');
150 shelfCollapse.on('click', function (event) {
151 event.preventDefault();
152 shelfSlider.slick('slickPrev');
155 let collectionsSlider = $('.js-collections .l-books');
156 let collectionsNextSlide = $('.js-collections .js-next-slide');
157 let collectionsPrevSlide = $('.js-collections .js-prev-slide');
159 collectionsSlider.slick({
177 collectionsNextSlide.on('click', function (event) {
178 event.preventDefault();
179 collectionsSlider.slick('slickNext');
182 collectionsPrevSlide.on('click', function (event) {
183 event.preventDefault();
184 collectionsSlider.slick('slickPrev');
187 let newBooksSlider = $('.js-new-books-slider .l-books');
188 let newBooksNextSlide = $('.js-new-books-slider .js-next-slide');
189 let newBooksPrevSlide = $('.js-new-books-slider .js-prev-slide');
191 newBooksSlider.slick({
209 newBooksNextSlide.on('click', function (event) {
210 event.preventDefault();
211 newBooksSlider.slick('slickNext');
214 newBooksPrevSlide.on('click', function (event) {
215 event.preventDefault();
216 newBooksSlider.slick('slickPrev');
222 let slider = $('.l-author__quotes__slider');
235 let sliderHomepage = $('.l-quotes');
236 sliderHomepage.slick({
239 centerPadding: '250px',
258 // Text overlay toggler
260 let overlays = $('.l-article__overlay');
261 let button = $('.l-article__read-more');
263 overlays.each(function () {
264 let maxHeight = $(this).attr('data-max-height');
265 if($(this).outerHeight() > maxHeight) {
266 $(this).css({'maxHeight': maxHeight+'px'}).addClass('is-active');
268 $(this).next('.l-article__read-more').hide();
272 button.on('click', function() {
273 let dataLabel = $(this).attr('data-label');
274 let dataAction = $(this).attr('data-action');
275 $(this).parent().find('.l-article__overlay').toggleClass('is-clicked');
276 if($(this).text() === dataLabel) {
277 $(this).text(dataAction);
279 $(this).text(dataLabel);
284 //Zmieniamy siÄ™ popup
286 let $change = $('.l-change-pop');
288 if(localStorage.getItem('change') === null) {
289 $change.addClass('show');
295 $change.on('click', '.l-change-pop__close', function () {
297 localStorage.setItem('change', 'showed');
301 if($change.length) { change(); }
304 function quit_experiment() {
305 document.cookie = 'EXPERIMENT_layout=off; path=/; max-age=31536000';
306 window.location.reload(true);
308 $(".quit-experiment").click(quit_experiment);
313 $('.l-checkout__payments__box button').on('click', function() {
314 let container = $(this).closest('.l-checkout__payments');
315 $('input', container).val($(this).val());
316 $('.is-active', container).removeClass('is-active');
317 $(this).closest('.l-checkout__payments__box').addClass('is-active');
327 let $copy = $('.js-copy');
329 $copy.on('click', function() {
330 let $copyText = $(this).closest('.l-checkout__info__item').find('input');
332 document.execCommand('copy');