var $ = jQuery.noConflict();
$(document).ready(function() {
$(window).on('popstate', function(e){
if(e.state) location.reload();
});
$('html').attr('id', 'js'); // Enabled Javascript Detection
if($("a[rel=external]")){
$("a[rel=external]").click(function() {
window.open(this.href);
return false;
});
}
$(".post_content a[href^='#']").click(function() {
var target = $(this).attr('href');
if ($(target).length) {
$('html, body').animate({scrollTop: $(target).offset().top - $("#header").height() - 40}, 800);
}
return false;
});
if ($(".with_animation_home").length) {
/*---animations---*/
/*TweenMax.from(".about_us", 2.5, {delay: 0.2, opacity: 0, scale:.5});
TweenMax.to(".about_us .cont_aboutus", 2, {delay: 0.2, rotationX: 0, startAt: {visibility: 'visible',opacity: 1}});*/
TweenMax.from(".title1", 1.2, {delay: 0.4, opacity: 0, top:300});
var twboxes = new TimelineMax()
.add(TweenMax.from(".box.red", 1, {delay: 1, scale:.7, autoAlpha:0}))
.add(TweenMax.from(".box.green", 0.5, {left:-500, autoAlpha:0}))
.add(TweenMax.from(".box.fiol", 0.5, {right:-500, autoAlpha:0}));
//Our works---------------------------------
var portfolioHome = new TimelineMax()
.add(TweenMax.from(".home_animation", 0.8, {opacity:0, top:400}))
.add(TweenMax.from(".home_animation .title_center", 0.5, {opacity: 0, top: 300}))
.add(TweenMax.from(".megafolio-container", 1.1, {opacity:0, rotation: 180, scale:0.5}, 0.6));
new ScrollMagic.Scene({
triggerElement: "#trigger1",
offset : '-300px',
reverse: false
})
.setTween(portfolioHome)
.addTo(controller);
//Testimonials---------------------------------
var testimonialsHome = new TimelineMax()
.add(TweenMax.from(".testimonials", 0.8, {opacity:0,top:200}))
.add(TweenMax.from(".our_clients", 0.6, {delay: 0.1,opacity:0,top:200}));
new ScrollMagic.Scene({
triggerElement: "#trigger2",
offset : '-200px',
reverse: false
})
.setTween(testimonialsHome)
.addTo(controller);
//Prices---------------------------------
var priceHome = new TimelineMax()
.add(TweenMax.from(".price_list", 0.8, {opacity:0,top:200}));
new ScrollMagic.Scene({
triggerElement: "#trigger_price",
offset : '-200px',
reverse: false
})
.setTween(priceHome)
.addTo(controller);
}
if ($(".with_animation_list").length) {
//what we can make---------------------------------
var makeBlocks = new TimelineMax()
.add(TweenMax.from(".make_block.make_site", 1, {opacity:0, scale:.2}))
.add(TweenMax.from(".make_block.make_style", 0.5, {opacity:0, top:300}))
.add(TweenMax.from(".make_block.make_app", 0.5, {opacity:0, top:300}));
}
if ($(".with_animation_team").length) {
$(".team_person").each(function (index, elem) {
var curImage = $(elem).find('.avatar_slider');
var curSlider = $(elem).find('.avatar_cycle');
var cube = new TimelineMax()
.add(TweenMax.to(curImage, 2, {css:{opacity:1, top:0}}));
new ScrollMagic.Scene({
triggerElement: elem,
offset : '-80px',
reverse: false
})
.setTween(cube)
.on('start', function () {
startCycle(curSlider);
})
.addTo(controller);
});
}
function init(){
var initialFadeIn = 800;
var itemInterval = 2500;
var fadeTime = 1200;
var numberOfItems = $('.bg_city .city img').length;
var currentItem = 1;
$('.bg_city .city img').eq(currentItem).fadeIn(initialFadeIn);
var infiniteLoop = setInterval(function(){
$('.bg_city .city img').eq(currentItem).fadeOut(fadeTime);
if(currentItem == numberOfItems -1){
currentItem = 0;
}else{
currentItem++;
}
$('.bg_city .city img').eq(currentItem).fadeIn(fadeTime);
}, itemInterval);
};
$(function(){
/*
Author: Chrysto Panayotov ( info@bassta.bg )
For GreenSock forums user azuki
License : http://bassta.bg/license/
*/
$(".make_block").on("mousemove", function(event){
var $parallaxContainer = $(this); //our container
var $parallaxItems = $parallaxContainer.find(".layers"); //elements
var fixer = 0.0009; //experiment with the value
var pageX = event.pageX - ($parallaxContainer.width() * 0.5); //get the mouseX - negative on left, positive on right
var pageY = event.pageY - ($parallaxContainer.height() * 0.5); //same here, get the y. use console.log(pageY) to see the values
$parallaxItems.each(function(){
var item = $(this);
var speedX = item.data("speed-x");
var speedY = item.data("speed-y");
TweenLite.set(item, {
x: (item.position().left + pageX * speedX )*fixer,
y: (item.position().top + pageY * speedY)*fixer
});
});
});
});
/*--animated boxes--*/
$(".green .title").hover(
function() {
$(this).closest('.box').addClass('active');
$(this).closest('.box').stop(true, true).delay(150).animate({ backgroundColor: "#f26232", borderColor: "#b7421b"},500);
$(this).closest('.box').find('.images_block .left.third').stop(true, true).animate({left: "-300px"},400);
$(this).closest('.box').find('.images_block .left.first').stop(true, true).delay(200).animate({left: "-300px"},400);
$(this).closest('.box').find('.images_block .right').stop(true, true).delay(200).animate({right: "-300px"},400);
$(this).closest('.box').find('.images_blockр .left').stop(true, true).delay(700).animate({left: "0"},300);
$(this).closest('.box').find('.images_blockр .left.first').stop(true, true).delay(700).animate({left: "0"},300);
$(this).closest('.box').find('.images_blockр .right').stop(true, true).delay(750).animate({right: "0"},300);
},
function() {
$(this).closest('.box').removeClass('active');
$(this).closest('.box').stop(true, true).delay(150).animate({ backgroundColor: "#7bbc00", borderColor: "#b9dc74"},500);
$(this).closest('.box').find('.images_blockр .left.third').stop(true, true).animate({left: "-300px"},400);
$(this).closest('.box').find('.images_blockр .left.first').stop(true, true).delay(200).animate({left: "-300px"},400);
$(this).closest('.box').find('.images_blockр .right').stop(true, true).delay(250).animate({right: "-300px"},400);
$(this).closest('.box').find('.images_block .left').stop(true, true).delay(700).animate({left: "0"},300);
$(this).closest('.box').find('.images_block .left.first').stop(true, true).delay(700).animate({left: "0"},300);
$(this).closest('.box').find('.images_block .right').stop(true, true).delay(750).animate({right: "0"},300);
}
);
$(".red .title").hover(
function() {
$(this).closest('.box').addClass('active');
$(this).closest('.box').stop(true, true).delay(150).animate({ backgroundColor: "#f26232", borderColor: "#b7421b"},500);
$(this).closest('.box').find('.images_block .left').stop(true, true).animate({left: "-300px"},400);
$(this).closest('.box').find('.images_block .right').stop(true, true).delay(150).animate({right: "-300px"},400);
$(this).closest('.box').find('.images_blockр .left').stop(true, true).delay(700).animate({left: "0"},300);
$(this).closest('.box').find('.images_blockр .right').stop(true, true).delay(750).animate({right: "0"},300);
},
function() {
$(this).closest('.box').removeClass('active');
$(this).closest('.box').stop(true, true).delay(150).animate({ backgroundColor: "#c82119", borderColor: "#fc8882"},500);
$(this).closest('.box').find('.images_blockр .left').stop(true, true).animate({left: "-300px"},400);
$(this).closest('.box').find('.images_blockр .right').stop(true, true).delay(150).animate({right: "-300px"},400);
$(this).closest('.box').find('.images_block .left').stop(true, true).delay(700).animate({left: "0"},300);
$(this).closest('.box').find('.images_block .right').stop(true, true).delay(750).animate({right: "0"},300);
}
);
$(".fiol .title").hover(
function() {
$(this).closest('.box').addClass('active');
$(this).closest('.box').stop(true, true).delay(150).animate({ backgroundColor: "#f26232", borderColor: "#b7421b"},500);
$(this).closest('.box').find('.images_block .left').stop(true, true).animate({left: "-300px"},400);
$(this).closest('.box').find('.images_block .right').stop(true, true).delay(150).animate({right: "-300px"},400);
$(this).closest('.box').find('.images_blockр .left').stop(true, true).delay(700).animate({left: "0"},300);
$(this).closest('.box').find('.images_blockр .right').stop(true, true).delay(750).animate({right: "0"},300);
},
function() {
$(this).closest('.box').removeClass('active');
$(this).closest('.box').stop(true, true).delay(150).animate({ backgroundColor: "#863181 ", borderColor: "#e195e6"},500);
$(this).closest('.box').find('.images_blockр .left').stop(true, true).animate({left: "-300px"},400);
$(this).closest('.box').find('.images_blockр .right').stop(true, true).delay(150).animate({right: "-300px"},400);
$(this).closest('.box').find('.images_block .left').stop(true, true).delay(700).animate({left: "0"},300);
$(this).closest('.box').find('.images_block .right').stop(true, true).delay(750).animate({right: "0"},300);
}
)
$( '.slideshow_box2' ).on( 'cycle-before', function(e, optionHash, outgoingSlideEl, incomingSlideEl, forwardFlag ) {
cur_height = $(incomingSlideEl).height();
cur_padding = $(incomingSlideEl).css('padding-bottom').replace("px", "");
$('.slideshow_box2').animate({
"height" : parseInt(cur_height) + parseInt(cur_padding)
});
});
$(".make_block .title").hover(
function() {
$(this).closest('.make_block').find('.item').addClass('hover');
},
function() {
$(this).closest('.make_block').find('.item').removeClass('hover');
}
)
$('.menu_block').on('click', '.open_menu', function() {
$(this).closest('.menu_block').find('.main_menu').toggleClass('active');
$('#footer').hide();
$('.site').addClass('stmenu');
if($('#header').hasClass('fixed')){
$('#header').removeClass('fixed');
$('#header_placeholder').css({display: 'none'});
}
return false;
});
$(".close_mobile_menu").click(function(){
$(".main_menu").removeClass("active");
$('#footer').show();
if ($(window).scrollTop() > 0){
$('#header').addClass('fixed');
$('#header_placeholder').css({display: 'block'});
}
$('.site').removeClass('stmenu');
return false;
});
$(".popup_about").fancybox({
type: 'ajax',
ajax: {
type : 'GET',
},
wrapCSS : 'fancy_styleone',
maxWidth : 980,
mwidth:980,
tpl: {
closeBtn : '',
},
helpers: {
overlay: {
locked: false
}
},
beforeShow:function (){
$('body').css('overflow','hidden');
},
afterClose:function (){
$('body').css('overflow','auto');
}
});
$(".popup_projects").fancybox({
type: 'ajax',
ajax: {
type : 'GET',
},
wrapCSS : 'fancy_styleone type2',
maxWidth : 980,
width:980,
tpl: {
closeBtn : '',
},
helpers: {
overlay: {
locked: false
}
},
beforeShow:function (){
$('body').css('overflow','hidden');
},
afterClose:function (){
$('body').css('overflow','auto');
}
});
$("body").on('click','.b_call, .b_callphone',function() {
$(this).closest('.cont_info').find('.popup_call').toggleClass("opened");
$(this).closest('.cont_info').find('.popup_call').slideToggle(300);
return false;
});
$(".tel").mask("+38 (999) 999 99 99",{placeholder:"+38 (___) ___ __ __"});
$('.popup_call .text input').autoClear();
$('.subscribe_form .subscribe_input').autoClear();
//$('.right_sidebar .search .s').autoClear();
$('.form_question input[type="text"]').autoClear();
$('.fast_answer input[type="text"]').autoClear();
$(document).click(function (e){
var container = $(".popup_call");
if (!container.is(e.target) && container.has(e.target).length === 0) {
container.slideUp(160);
}
});
$('.tab_menu a').click(function() {
var click_id=$(this).attr('id');
if (click_id != $('.tab_menu a.active').attr('id') ) {
$('.tab_menu a').closest('li').removeClass('active');
$(this).closest('li').addClass('active');
$('.tabs .tab_content').removeClass('active');
$('#con_' + click_id).addClass('active');
}
setFixedBar();
return false;
});
$(".accordion h3").click(function(){
$(this).next("div.accordcont").slideToggle(500)
.siblings("div.accordcont:visible").slideUp(500);
$(this).toggleClass("active");
$(this).siblings("h3").removeClass("active");
});
if ($(".sl_hist").length) {
$('.cycle-slideshow').on('cycle-update-view', function (e, optionHash, slideOptionsHash, currentSlideEl) {
var caption = (optionHash.currSlide) //+ ' of ' + optionHash.slideCount; //alert(optionHash.currSlide);
$( ".handl_slider" ).slider( "option", "value", caption );
var mainYear = $(currentSlideEl).find('h2.year').html();
/*
if (caption == 0) {
$('.history .btn_next').html(2001);
$('.history .btn_prev').html(2016);
} else if (caption == 16) {
$('.history .btn_next').html(2000);
$('.history .btn_prev').html(2015);
} else {*/
$('.history .btn_next').html(parseInt(mainYear) + 1).css({opacity: '1'});
$('.history .btn_prev').html(parseInt(mainYear) - 1).css({opacity: '1'});
//}
});
$(function() {
$(".handl_slider").slider({
orientation: "horizontal",
min: 0,
max: 17,
value: 0,
slide: function( event, ui ) {
$(".sl_hist").cycle(ui.value);
if(ui.value> 16) {
return false;
}
}
});
});
}
$(".rating input:radio").attr("checked", false);
$('.rating input').click(function () {
if (!$(this).closest(".like_rating").hasClass('disabled')){
$(this).closest('.rating').find("span").removeClass('checked');
$(this).parent().addClass('checked');
}
});
/*---new portfolio---*/
if ($(".typemain_page").length) {
api = $('.megafolio-container').megafoliopro({
filterChangeAnimation:"rotatescale",
filterChangeSpeed:500,
filterChangeRotate:99,
filterChangeScale:0.6,
delay:20,
paddingHorizontal:5,
paddingVertical:5,
layoutarray:[9]
});
}
if ($(".typeportfolio_page").length) {
api = $('.megafolio-container').megafoliopro({
filterChangeAnimation:"rotatescale",
filterChangeSpeed:600,
filterChangeRotate:99,
filterChangeScale:0.6,
delay:20,
paddingHorizontal:22,
paddingVertical:22,
layoutarray:[10]
});
}
$('.filter').click(function(){
api.megafilter($(this).data('category'));
if($(this).data('category') == 'cat-all') {
$('.mega-entry').addClass('withcat');
$('.mega-entry').removeClass('withoutcat');
} else {
$('.mega-entry').addClass('withoutcat');
$('.mega-entry').removeClass('withcat');
}
//console.log(api.megafilter($(this).data('category')));
$('.filter').closest('li').removeClass('active');
$(this).closest('li').addClass('active');
return false;
});
$('.swap_btn.normal').click(function() {
$(this).addClass('active');
$('.swap_btn.mozaika').removeClass('active');
/*$(".mega-entry").each(function() {
$(".mega-entry").animate({
padding-right' : 22,
padding-bottom' : 22
}, 10);
});*/
api.megaremix($(this).data('order'));
return false;
});
$('.swap_btn.mozaika').click(function() {
$(this).addClass('active');
$('.swap_btn.normal').removeClass('active');
/*$(".mega-entry").each(function() {
$(".mega-entry").animate({
padding-right' : 5,
padding-bottom' : 5
}, 10);
});*/
api.megaremix($(this).data('order'));
return false;
});
$('.lr_form').on('click', '.bl_withyey .btn_shpass', function() {
$(this).closest('.bl_withyey').find('input').attr('type', 'text');
$(this).closest('.bl_withyey').addClass('hide');
});
$('.lr_form').on('click', '.bl_withyey.hide .btn_shpass', function() {
$(this).closest('.bl_withyey').find('input').attr('type', 'password');
$(this).closest('.bl_withyey').removeClass('hide');
});
/*
можно брать значения
$('.rating input:radio').change(
function(){
var userRating = this.value;
alert(userRating);
});*/
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf_token"]').attr('content')
}
});
ccrousel('.contentpages','.ccrousel','.ccrousel li','.arrows_years .left','.arrows_years .right');
});
/*---end doc ready----*/
function ccrousel(uppermain,mainblock,insidelist,arrowleft,arrowright) {
var widthBl = $(insidelist).width();
var mainWidth = $(uppermain).width();
var fullWidth = $(insidelist).size();
var currentWidth = widthBl*fullWidth;
$(mainblock).width(currentWidth);
var differenceS = mainWidth - currentWidth;
$(arrowleft).click(function() {
$(mainblock).css({ 'left': '0px' });
$(arrowright).css({ 'opacity': '1', 'cursor' : 'pointer'});
$(this).css({ 'opacity': '0.4' , 'cursor' : 'default' });
return false;
});
$(arrowright).click(function() {
$(mainblock).css({ 'left': differenceS });
$(arrowleft).css({ 'opacity': '1', 'cursor' : 'pointer'});
$(this).css({ 'opacity': '0.4' , 'cursor' : 'default' });
return false;
});
//console.log(differenceS);
//console.log(fullWidth);
}
/*---end doc ready----*/
$(window).load(function() {
setFixedBar();
});
$(window).resize(function(){
setFixedBar();
$( '.slideshow_box2' ).height('auto');
});
function startCycle(curSl) {
$(curSl).cycle({
fx : 'shuffle',
timeout : 4000,
speed : 1000,
reverse : true,
shuffleTop : "7px",
shuffleLeft : "7px",
hideNonActive : false
});
}
function setFixedBar() {
if ($('.fixed_right_nav').length) {
var top, bottom = '';
var top = $('.fixed_right_nav').offset().top - 140;
var bottom = top+$('.question_box').outerHeight()-$('.fixed_right_nav').outerHeight() - 80;
//console.log(top);
//console.log(bottom);
$(window).scroll(function (event) {
$('.fixed_right_nav').removeClass('fixed_bottom');
$('.fixed_right_nav').removeClass('fixed');
var y = $(this).scrollTop();
if ((y >= top) && ($(window).width() > 980)) {
if (y >= bottom) {
$('.fixed_right_nav').addClass('fixed_bottom');
$('.fixed_right_nav').removeClass('fixed');
} else {
$('.fixed_right_nav').addClass('fixed');
$('.fixed_right_nav').removeClass('fixed_bottom');
}
} else {
$('.fixed_right_nav').removeClass('fixed');
$('.fixed_right_nav').removeClass('fixed_bottom');
}
});
}
}
function setEqualHeight(columns) {
var tallestcolumn = 0;
columns.each(
function() {
currentHeight = $(this).height();
if(currentHeight > tallestcolumn) {
tallestcolumn = currentHeight;
}
}
);
columns.height(tallestcolumn);
}
(function($) {
$.fn.autoClear = function () {
$(this).each(function() {
$(this).data("autoclear", $(this).attr("value"));
});
$(this)
.bind('focus', function() {
if ($(this).attr("value") == $(this).data("autoclear")) {
$(this).attr("value", "").addClass('autoclear-normalcolor');
}
})
.bind('blur', function() {
if ($(this).attr("value") == "") {
$(this).attr("value", $(this).data("autoclear")).removeClass('autoclear-normalcolor');
}
});
return $(this);
}
})(jQuery)
$(window).scroll(function(){
if ($( window ).width() > 980) {
if( ($(window).scrollTop() > 23) && (!$('.main_menu').hasClass('active'))){
$('#header').addClass('fixed');
$('#header_placeholder').css({display: 'block'});
}
else {
$('#header').removeClass('fixed');
$('#header_placeholder').css({display: 'none'});
}
} else {
if( ($(window).scrollTop() > 0) && (!$('.main_menu').hasClass('active'))){
$('#header').addClass('fixed');
$('#header_placeholder').css({display: 'block'});
}
else {
$('#header').removeClass('fixed');
$('#header_placeholder').css({display: 'none'});
}
}
});
$(window).resize(function(){
if ($(window).width() < 980) {
$('#list2').addClass('nopc');
} else if ($(window).width() > 980) {
$('#list2').removeClass('nopc');
}
});
function get_posts (rubrica, lang) {
if (rubrica == 'all'){
if (lang == 'ua'){
url = '/ua/blog';
}else{
url = '/blog';
}
}else {
if (lang == 'ua'){
url = '/ua/blog/category/' + rubrica;
}else{
url = '/blog/category/' + rubrica;
}
}
$.get(url, {page: next_page, rubrica: rubrica, ajx: true}, function(data) {
$('#post_button_more').before(data);
$("div.blog_box div.posts_list").last().hide().slideDown( "slow");
make_reyt(lang);
$('.rating input').click(function () {
if (!$(this).closest(".like_rating").hasClass('disabled')){
$(this).closest("span").removeClass('checked');
$(this).parent().addClass('checked');
}
});
}).done(function (data){
var curent_ajax_page = next_page;
var previos_ajax_page = next_page - 1;
window.history.pushState({curent_ajax_page: curent_ajax_page},'title', url+'?page='+curent_ajax_page);
if (curent_ajax_page >= lastPage){
$("#post_button_more").remove();
}else{
next_page++;
}
});
}
function get_search_posts (search_words, lang) {
let url = '/blog/search?s='+search_words;
if (lang == 'ua') {
url = '/ua/blog/search?s='+search_words;
}
$.get(url, {page: next_page, ajx: true}, function(data) {
$('#post_button_more').before(data);
$("div.blog_box div.posts_list").last().hide().slideDown( "slow");
make_reyt(lang);
$('.rating input').click(function () {
if (!$(this).closest(".like_rating").hasClass('disabled')){
$(this).closest("span").removeClass('checked');
$(this).parent().addClass('checked');
}
});
}).done(function (data){
var curent_ajax_page = next_page;
var previos_ajax_page = next_page - 1;
if (lang == 'ua'){
window.history.pushState({curent_ajax_page: curent_ajax_page},'title', '/ua/blog/search?s='+search_words+'&page='+curent_ajax_page);
}else{
window.history.pushState({curent_ajax_page: curent_ajax_page},'title', '/blog/search?s='+search_words+'&page='+curent_ajax_page);
}
if (curent_ajax_page >= lastPage){
$("#post_button_more").remove();
}else{
next_page++;
}
});
}
function reply_msg(msg_id) {
$("#mid").val(msg_id);
$('html, body').animate({scrollTop:$("#smsg").offset().top-150}, 'slow');
return false;
}
function send_blog_msg(only_msg) {
var pid = $("#pid").val();
var mid = $("#mid").val();
var name = (!only_msg) ? $("#uname").val() : '';
var email = (!only_msg) ? $("#email").val() : '';
var site = (!only_msg) ? $("#site").val() : '';
var message = $("#message").val();
var error = false;
if (!only_msg) {
if (name == ''){
error = true;
$("#uname").addClass('input_text_error');
$("#name_error").css('display','block');
$("#uname").css({'background-color':'#ffb9b9'});
}else{
$("#uname").removeClass('input_text_error');
$("#name_error").css('display','none');
$("#uname").css({'background-color':'#fff'});
}
if (!isValidEmail(email)){
error = true;
$("#email").addClass('input_text_error');
$("#email_error").css('display','block');
$("#email").css({'background-color':'#ffb9b9'});
}else{
$("#email").removeClass('input_text_error');
$("#email_error").css('display','none');
$("#email").css({'background-color':'#fff'});
}
}
if (message == ''){
error = true;
$("#message").addClass('input_text_error');
$("#msg_error").css('display','block');
$("#message").css({'background-color':'#ffb9b9'});
}else{
$("#message").removeClass('input_text_error');
$("#msg_error").css('display','none');
$("#message").css({'background-color':'#fff'});
}
if (!error) {
$("#msg_post_error").hide();
$.post("/blog/send-msg",{post_id: pid, msg_id: mid,name: name, email: email, site: site, message: message, only_msg: only_msg}, function(data){
if (data == '') {
$("#msg_post_res").show('slow').delay( 800 ).fadeOut( 400 );
$('#msg_comment_form')[0].reset();
}else {
$("#msg_post_error").text(data);
$("#msg_post_error").show('slow');
}
});
}
}
function isValidEmail (email) {
return (/^([a-z0-9_\-]+\.)*[a-z0-9_\-]+@([a-z0-9][a-z0-9\-]*[a-z0-9]\.)+[a-z]{2,4}$/i).test(email);
}
function getCookie(name) {
var matches = document.cookie.match(new RegExp(
"(?:^|; )" + name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, '\\$1') + "=([^;]*)"
));
return matches ? decodeURIComponent(matches[1]) : undefined;
}
function setCookie(name, value, options) {
options = options || {};
var expires = options.expires;
if (typeof expires == "number" && expires) {
var d = new Date();
d.setTime(d.getTime() + expires * 1000);
expires = options.expires = d;
}
if (expires && expires.toUTCString) {
options.expires = expires.toUTCString();
}
value = encodeURIComponent(value);
var updatedCookie = name + "=" + value;
for (var propName in options) {
updatedCookie += "; " + propName;
var propValue = options[propName];
if (propValue !== true) {
updatedCookie += "=" + propValue;
}
}
document.cookie = updatedCookie;
}
function deleteCookie(name) {
setCookie(name, "", {
expires: -1
})
}
function make_reyt(lang) {
$(".rating input:radio").click(function (){
let reyt = this.value;
re = /_(\d+)_/i
raw_post_id = this.id.match(re)
let post_id = raw_post_id[1];
if (reyt.isNumber() && post_id.isNumber()) {
if (lang == 'ua'){
$.post("/ua/blog/reyt_post", {post_id: post_id, reyt: reyt});
}else{
$.post("/ru/blog/reyt_post", {post_id: post_id, reyt: reyt});
}
}
// return false;
});
}
$(document).ready(function() {
$("#subscriber_email").keydown(function (e) {
if (e.keyCode == 13) {
subscribe_user();
e.preventDefault();
return false;
}
});
});
String.prototype.isNumber = function(){
return /^\d+$/.test(this);
}
function subscribe_user($lang) {
var subscriber_email = $("#subscriber_email").val();
$.post("/" + $lang + "/blog/subscribe", {email:subscriber_email}, function (data) {
$("#msg_subscribe_error").text('');
$("#msg_subscribe_error").hide();
$('#subscribe_form')[0].reset();
if (data == '') {
$("#msg_subscribe_res").show('slow').delay( 1600 ).fadeOut( 400 );
$("#subscriber_email").css({'background-color':'#fff'});
}else {
$("#msg_subscribe_error").text(data);
$("#msg_subscribe_error").show('slow');
$("#subscriber_email").css({'background-color':'#ffb9b9'});
}
});
}