// Legacy ?
$(function () {
$('#all-lang').change(function () {
if ($(this).is(':checked')) {
$('#biblia_search').hide();
$('#yandex_search').show();
} else {
$('#biblia_search').show();
$('#yandex_search').hide();
}
});
});
function copyToClipboard(text) {
console.log('copyToClipboard', text);
if (window.clipboardData && window.clipboardData.setData) {
// Internet Explorer-specific code path to prevent textarea being shown while dialog is visible.
return window.clipboardData.setData("Text", text);
} else if (document.queryCommandSupported && document.queryCommandSupported("copy")) {
var textarea = document.createElement("textarea");
textarea.textContent = text;
textarea.style.position = "fixed"; // Prevent scrolling to bottom of page in Microsoft Edge.
document.body.appendChild(textarea);
textarea.select();
try {
let res = document.execCommand("copy"); // Security exception may be thrown by some browsers.
AZ.notify('Скопировано');
return res;
} catch (ex) {
console.warn("Copy to clipboard failed.", ex);
AZ.notify('Ошибка при копировании');
return false;
} finally {
document.body.removeChild(textarea);
}
}
}
(function() {
/* GLOBALS */
AZ.doc = $(document);
AZ.html = $('html');
AZ.body = $('body');
AZ.header = $('.header');
/*desktop body class*/
if(!AZ.is_mobile)
AZ.body.addClass('desktop');
else{ // scrolling classes
let scrollingTimeout = false;
let deScrolling = ()=>AZ.body.removeClass('scrolling');
AZ.doc.on('touchmove', e=>AZ.body.addClass('scrolling'));
AZ.doc.on('touchend', e=>{
clearTimeout(scrollingTimeout);
scrollingTimeout = setTimeout(deScrolling, 20);
});
}
/* прокрутка к якорям */
AZ.scrollTo = function (trg, arg = {center: false, offset: 0}) {
trg = $(trg);
if (trg.length) {
let offset = arg.center ? (window.innerHeight / 2 - trg.height() / 2) : (((!AZ.header.length || $('html').is('.hide-header')) ? 0 : AZ.header.height()) + 30 + (arg.offset ? arg.offset : 0));
console.log('offset', offset);
$('html, body').animate({scrollTop: trg.offset().top - offset}, 500);
return true;
}
return false;
}
/* всплывающее сообщение */
AZ.popTip = (txt, trg) => {
let rect = $(trg)[0].getBoundingClientRect();
if (!rect) return false;
let tip = $('
' + txt + '
').css({
'top': (rect.top - 30) + 'px',
'left': (rect.left + rect.right) / 2 + 'px'
});
AZ.body.append(tip);
setTimeout(() => {
tip.remove()
}, 2000);
}
} )();
$(function () {
$('body').click(function(e) {
if(e.target.classList.contains('btn-title-link-copy')){
copyToClipboard($(e.target).data('url'));
e.target.classList.add('copied');
setTimeout(()=>{e.target.classList.remove('copied');}, 3000);
}
});
});
$(function () {
$('#all-lang').change(function () {
if ($(this).is(':checked')) {
$('#biblia_search').hide();
$('#yandex_search').show();
} else {
$('#biblia_search').show();
$('#yandex_search').hide();
}
});
// GLOBALS + ON SCROLL
let html = AZ.html,
body = AZ.body,
hdr = $('.header'),
is_mobile = AZ.is_mobile,
lastScrollTop = 0,
bottomHideTO,
bottomHide = () => {
body.removeClass('show-bottom-panel');
},
getBottomHideTime = ()=>{
return html.attr('data-bottom-hide-speed') || 2000;
};
AZ.showBottomPanel = () => {
if (is_mobile || html.hasClass('floating-bottom-panel')) {
body.addClass('show-bottom-panel');
clearTimeout(bottomHideTO);
let time = getBottomHideTime();
if(time !== 'never')
bottomHideTO = setTimeout(bottomHide, time);
}
};
AZ.showBottomPanel();
$('.lb-nav, .rb-nav, .footer').click(AZ.showBottomPanel);
$(document).scroll(function (e) {
let st = window.scrollY;
if (st != lastScrollTop) {
AZ.showBottomPanel();
}
lastScrollTop = st {
clearTimeout(bottomHideTO);
});
bottom_panel.on('touchend mouseleave', e => {
let time = getBottomHideTime();
if(time !== 'never')
bottomHideTO = setTimeout(bottomHide, time);
});
//show/hide rb-nav
$('.rb-nav .btn-hide').click(e=>{
toggleSetting("hide-rbnav");
});
//MOBILE MENU
let mob_menu_activate = function (e) {
let t = $(this), targ = $(t.attr('data-target'));
if (!targ.length) return;
if (!t.hasClass('active')) {
mob_menu_activate.call($('#mobile-nav .active'));//deactivate current
if (targ.is('.settings-wrap')) return;
t.addClass('active');
if (targ.is('.form_search'))
setTimeout(() => {
$('.inp_search').focus()
}, 500);
targ.addClass('active');
if (targ.closest('.header').length) {
targ.slideDown();
hdr.addClass('active');
}
} else {
t.removeClass('active');
targ.removeClass('active');
if (targ.closest('.header').length) {
targ.slideUp();
hdr.removeClass('active');
}
}
}
$('#mobile-nav .link').click(mob_menu_activate);
$('.header__close').click(e => mob_menu_activate.call($('#mobile-nav .active')));
$('body').click(e => {
if (!$(e.target).closest('.active').length) {
mob_menu_activate.call($('#mobile-nav .active'));
}
});
/* спрятать/показать верхнее меню (десктоп) */
$('.header__toggle').click(e => {
toggleSetting('hide-header');
});
/* Без лишней прокрутки */
if (location.hash) {
setTimeout(function () {
window.scrollTo(0, 0);
}, 1);
AZ.scrollTo(location.hash);
}
$('a[href^="#"]').click(function (e) {
if (AZ.scrollTo($(this).attr('href'))) {
e.preventDefault();
}
});
/* popups */
$('.popup-link').click(function (e) {
$(this.dataset['target']).toggleClass('active');
});
AZ.closePopup = (t) => {
let $t = $(t);
$t.removeClass('active');
if (AZ.popup_on_close[$t.attr('id')])
AZ.popup_on_close[$t.attr('id')]();
};
$('.popup-wrap').click(function (e) {
if ($(e.target).is('.popup-wrap')) {
AZ.closePopup(e.target);
}
});
$('.popup .btn-close, .popup .btn-cancel, .popup .btn-ok').click(function (e) {
AZ.closePopup($(this).closest('.popup-wrap'));
});
AZ.alert = (text, onYes) => {
let $pop = $('#alert_popup');
$('.title', $pop).html(text);
$('.btn-ok', $pop)[0].onclick = onYes;
$pop.addClass('active');
};
AZ.confirm = (text, onYes, onNo) => {
let $pop = $('#confirm_popup');
$('.title', $pop).html(text);
$('#confirm_true')[0].onclick = onYes;
$('#confirm_false')[0].onclick = onNo;
$pop.addClass('active');
};
// Само-исчезающее уведомление
AZ.notify = (msg, opts = {}) => {
let $panel = $($('#notification_template').html());
$panel.html(msg);
if(opts.side === 'left')
$panel.addClass('left-side');
$('#notification_container').prepend($panel);
$panel.delay(10).slideDown().delay(3000).slideUp(() => {
$panel.remove()
});
}
// Главы в верхнем списке книг
$('.cloud-book-wrap').on("mouseenter click", function(e){
if($(this).find('.cloud-chapter-links').length) return;
let targ = $(this).find('.cloud-book'), addon = '';
for(let i=1; i'+i+'';
}
addon+='';
this.innerHTML+=addon;
let links = $(this).find('.cloud-chapter-links');
if(links.offset().left + links.width() > window.innerWidth - 50)
links.addClass('near-right');
return false;
});
});
Pomogite-sovetom-i-molitvoj.5520
Istoriya-rossii-v-rasskazax-dlya-detej-ishimova
Astro-quest-point-&-click-adventure-game-on-pc
661
310