/*
(function($){
// alert('test');
var _this = $(this),
floatStickyBlock = $('.float-sticky-block'),
floatStickyBlockH,
beforeFloatStickyBlockOffset,
offsetBottom;
// floatStickyBlock.hide();
alert( floatStickyBlock.length );
if ( floatStickyBlock.length > 0 )
{
// alert('test');
$(window).load(function(){
floatStickyBlockH = floatStickyBlock.outerHeight();
beforeFloatStickyBlockOffset = $('.before-float-sticky-block').offset().top - 80;
offsetBottom = $('footer').offset().top + 30;
})
$(window).scroll(function(){
// alert('scroll');
if ( (_this.scrollTop() > beforeFloatStickyBlockOffset) && ( (_this.scrollTop() + floatStickyBlockH + 200) < offsetBottom) ) {
floatStickyBlock.addClass('fixed');
}
else {
floatStickyBlock.removeClass('fixed');
}
});
}
})(jQuery)
*/
// Add to favourites
function addToFavorites(a){
var title = document.title,
url = document.location;
try {
// Internet Explorer
window.external.AddFavorite(url, title);
}
catch (e) {
try {
// Mozilla
window.sidebar.addPanel(title, url, "");
}
catch (e) {
// Opera
if (typeof(opera)=="object" || window.sidebar) {
a.rel="sidebar";
a.title=title;
a.url=url;
a.href=url;
return true;
}
else {
// Unknown
alert('Нажмите Ctrl-D чтобы добавить страницу в закладки');
return false;
}
}
}
}
jQuery(document).ready(function($) {
win_width= $(window).width();
$('[data-toggle="tooltip"]').tooltip();
var $allVideos = $("iframe[src^='http://player.vimeo.com'], iframe[src^='//player.vimeo.com'], iframe[src*='//www.youtube.com'], object, embed"),
$fluidEl = $allVideos.parent()
$allVideos.each(function() {
$(this)
// jQuery .data does not work on object/embed elements
.attr('data-aspectRatio', this.height / this.width)
.removeAttr('height')
.removeAttr('width');
});
$(window).resize(function() {
$allVideos.each(function() {
var $el = $(this),
newWidth = $el.parent().width();
$el
.width(newWidth)
.height(newWidth * $el.attr('data-aspectRatio'));
})
}).resize();
$(window).resize(function(){
if((win_width<= 1200&& $(window).width()> 1200)|| (win_width> 1200&& $(window).width()<= 1200)) {
location.reload();
}
});
if (win_width < 1200) {
$('#site_left_menu').css({'opacity': '1'});
$('.responsive_tabs').tabCollapse();
$(document).mouseup(function (e) {
var container = $("#menu-glavnoe-menyu").parent('nav');
if (container.has(e.target).length === 0 && $(container).hasClass('in')){
$('.navbar-toggle').click();
}
});
$("#site_left_menu").mmenu({
classes: 'mm-slide',
counters: {
add: true,
update: true
},
header: {
add: true,
update: true,
title: 'Меню сайта'
},
dragOpen: {
open: true
}
});
$('#site_main_menu').remove();
}
if (win_width > 1200) {
$('#click-menu').remove();
$('ul > .current-menu-item > a').each(function(){
active_text= $(this).html();
$(this).replaceWith(''+active_text+'');
});
$('#site_main_menu').css({'opacity': '1'});
$('#site_left_menu, #left_menu_call').remove();
$('#fixed_header').affix({
offset: {
top: 180
}
})
}
$('.carousel').carousel({
interval: 6000
});
//$.cookie('show_other_hide', null);
$('.single_articel').find('table').addClass('table table-striped table-condensed');
$('.search_form_button').click(function(){
if(!$('#searchform_head input').val().length) {
$('#searchform_head').toggleClass('head_form_active');
} else {
$('#searchform_head').submit();
}
})
$(document).click(function(event){
if (!$(event.target).closest(".search_form_button").length && !$(event.target).closest("#searchform_head").length) {
$('#searchform_head').removeClass('head_form_active');
$('#searchform_head input').val('');
}
})
$('.smooth_scroll a[href^="#"], #toc_container a[href^="#"], #scroll_to_top_button').click(function() {
var target = $(this).attr('href');
$('html, body').animate({scrollTop: $(target).offset().top-120}, 500);
return false;
});
$('form[role="search"]').submit(function(event){
if(!$(this).find('input[type=text]').val().length){
//alert('Введите поисковый запрос!');
$(this).find('input[type=text]').css({'border': '1px solid #FF0000'});
return false;
} else {
return true;
}
})
$('aside .widget_wysija:first').addClass('subscribe_widget');
$('.show_other_close').click(function(){
$(this).hide();
$('.show_other_show').show();
$('#show_other').css({'right': '-330px'});
$.cookie('show_other_hide', 'hide');
});
$('.show_other_show').click(function(){
$(this).hide();
$('.show_other_close').show();
$('#show_other').css({'right': '-0'});
});
$(window).scroll(function(){
var aside_height= $('.main_text').outerHeight()- 600;
if($('#scroll_to_top_button').attr('data-show')){
var scroll_to_top_button_show= $('#scroll_to_top_button').attr('data-show');
} else {
var scroll_to_top_button_show= 500;
}
if($(this).scrollTop()> scroll_to_top_button_show){
$('#scroll_to_top_button').css({'opacity': '1'});
} else {
$('#scroll_to_top_button').css({'opacity': '0'});
}
if($(this).scrollTop()> aside_height){
if($.cookie('show_other_hide')!= 'hide') {
$('#show_other').css({'right': '0'});
$('.show_other_show').hide();
$('.show_other_close').show();
} else {
if($('#show_other').css('right')!= '0px') {
$('.show_other_show').show();
$('.show_other_close').hide();
}
}
} else {
$('#show_other').css({'right': '-330px'});
$('.show_other_show').show();
$('.show_other_close').hide();
}
})
});
//ready
function addLink() {
var body_element = document.getElementsByTagName('body')[0];
var selection;
selection = window.getSelection();
var pagelink = "
Источник: "+document.location.href+"";
var copytext = selection + pagelink; var newdiv = document.createElement('div');
newdiv.style.position='absolute'; newdiv.style.left='-99999px'; body_element.appendChild(newdiv);
newdiv.innerHTML = copytext; selection.selectAllChildren(newdiv); window.setTimeout(function() {
body_element.removeChild(newdiv); },0);
}
document.oncopy = addLink;
function left_side_share_pos() {
var left_side_share_left = jQuery('div.container').offset().left;
jQuery('.left_side_share').css({'left': left_side_share_left - 60 + 'px'});
}