3 let button = $('.js-menu');
4 let menu = $('.l-navigation__menu');
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 button.find('.bar').addClass('animate');
12 menuLinks.attr('tabindex', 0);
14 $(this).removeClass('is-active');
15 menu.removeClass('is-open');
16 button.find('.bar').removeClass('animate');
17 menuLinks.attr('tabindex', -1);
21 $(document).keyup(function(e) {
22 if (e.keyCode === 27) {
23 button.removeClass('is-active');
24 menu.removeClass('is-open');
25 button.find('.bar').removeClass('animate');
26 menuLinks.attr('tabindex', -1);
31 // Ebook/Audiobook Btns
33 let button = $('.c-media__btn button:not(.l-button--media--full)');
34 let popupLayer = $('.c-media__popup');
35 let closeButton = $('.c-media__popup__close');
36 let playButton = $('.c-player__btn--md');
37 let chaptersButton = $('.c-player__chapters span');
38 let select = $('.c-select');
39 let selectItem = $('.c-select li');
40 let volumeButton = $('.icon-volume');
42 /*playButton.on('click', function() {
43 if($(this).find('.icon').hasClass('icon-play')) {
44 $(this).find('.icon-play').removeClass('icon-play').addClass('icon-pause');
45 } else if($(this).find('.icon').hasClass('icon-pause')) {
46 $(this).find('.icon-pause').removeClass('icon-pause').addClass('icon-play');
50 button.on('click', function () {
51 let target = $(this).attr('id');
52 $('[data-popup=' + target).addClass('is-open');
53 $('body').addClass('popup-open');
56 closeButton.on('click', function() {
57 $(this).closest('.c-media__popup').removeClass('is-open');
58 $('body').removeClass('popup-open');
61 popupLayer.on('click', function(e) {
63 if($(e.target).is(popupLayer)) {
64 _this.removeClass('is-open');
65 $('body').removeClass('popup-open');
69 chaptersButton.on('click', function() {
70 $(this).parent().toggleClass('is-active');
73 select.on('click', function() {
74 $(this).toggleClass('is-active');
77 selectItem.on('click', function() {
78 selectItem.removeClass('is-active');
79 $(this).addClass('is-active');
82 volumeButton.on('click', function() {
83 if($(this).hasClass('icon-volume')) {
84 $(this).removeClass('icon-volume').addClass('icon-mute');
85 $(this).next().val(0);
86 $(this).next().css('background-size', '0% 100%');
87 } else if($(this).hasClass('icon-mute')) {
88 $(this).removeClass('icon-mute').addClass('icon-volume');
89 $(this).next().val(50);
90 $(this).next().css('background-size', '50% 100%');
94 $(document).keyup(function(e) {
95 if (e.keyCode === 27) {
96 $('.c-media__popup').removeClass('is-open');
102 const rangeInputs = document.querySelectorAll('input[type="range"]')
104 function handleInputChange(e) {
105 let target = e.target
106 if (e.target.type !== 'range') {
107 target = document.getElementById('range')
109 const min = target.min
110 const max = target.max
111 const val = target.value
113 target.style.backgroundSize = (val - min) * 100 / (max - min) + '% 100%'
116 rangeInputs.forEach(input => {
117 input.addEventListener('input', handleInputChange)
122 let slider = $('.l-author__quotes__slider');
135 // Text overlay toggler
137 let overlays = $('.l-article__overlay');
138 let button = $('.l-article__read-more');
140 overlays.each(function () {
141 let maxHeight = $(this).attr('data-max-height');
142 if($(this).outerHeight() > maxHeight) {
143 $(this).css({'maxHeight': maxHeight+'px'}).addClass('is-active');
145 $(this).next('.l-article__read-more').hide();
149 button.on('click', function() {
150 let dataLabel = $(this).attr('data-label');
151 let dataAction = $(this).attr('data-action');
152 $(this).parent().find('.l-article__overlay').toggleClass('is-clicked');
153 if($(this).text() === dataLabel) {
154 $(this).text(dataAction);
156 $(this).text(dataLabel);
161 //Zmieniamy siÄ™ popup
163 let $change = $('.l-change-pop');
165 if(localStorage.getItem('change') === null) {
166 $change.addClass('show');
172 $change.on('click', '.l-change-pop__close', function () {
174 localStorage.setItem('change', 'showed');
178 if($change.length) { change(); }
183 let $switchOnce = $('#switch-once');
184 let $switchMonthly = $('#switch-monthly');
186 $switchMonthly.on('click', function() {
187 $('.l-checkout__payments__box').removeClass('once');
190 $switchOnce.on('click', function() {
191 $('.l-checkout__payments__box').addClass('once');
197 let $copy = $('.js-copy');
199 $copy.on('click', function() {
200 let $copyText = $(this).closest('.l-checkout__info__item').find('input');
202 document.execCommand('copy');