function dialogue(content, title) { content = $('
', { 'class': 'dialogue clearfix' }).append(content); $.iLightBox([ { URL: content, type: "html", title: (title) ? title : null } ], { skin: 'light ilightbox-dialogue', minScale: 1, innerToolbar: true, overlay: { blur: false }, controls: { fullscreen: false }, callback: { // Hide the iLightBox when any buttons in the dialogue are clicked onRender: function(api) { $('.btn', api.currentElement).click(function(){ $('.btn', api.currentElement).unbind('click'); api.hide(); }); }, // Hide the iLightBox when any buttons in the dialogue are clicked onShow: function(api) { $('.btn-primary', api.currentElement).focus(); } } }); } function videoConfirm(callback){ var message = $('', { html: '' }), cancel = $('', { html: "Закрить", 'class': 'btn alert_button', 'style': 'display:block;margin:0px auto;width:150px;', click: function() { callback(false); $('.dialogue').hide(); console.log($('.dialogue')); } }); dialogue( message.add(cancel), "Потрібна допомога?", function() { callback(false); } ); } function Confirm(question, title, callback) { // Content will consist of the question and ok/cancel buttons var message = $('', { html: question }), ok = $('', { html: "Перейти до кошику", 'class': 'btn btn-primary alert_button', click: function() { callback(true); }, keyup: function(e){ if(e.keyCode == 13) $(this).trigger('click'); } }), cancel = $('', { html: "Продовжити покупки", 'class': 'btn alert_button', click: function() { callback(false); } }); video = $('', { html: "Потрібна допомога?", 'class': 'btn alert_button', 'style': 'display:block;margin:0px auto;width:200px;', click: function() { callback(false);videoConfirm(callback); } }); dialogue( message.add(cancel).add(ok).add(video), title, function() { callback(false); } ); } function p(val) { console.info(val); } var val; function get() { getNovaPoshtaCity(); } function getNovaPoshtaCity() { $( "#order_city_novaposhta" ).autocomplete({ source: function( request, response ) { $.ajax({ url: '/ajax/get_cities', data : { term : request.term }, scriptCharset: "utf-8", type : "POST", dataType: 'json', success: function( data ) { if( val == 1 ) { response( data ); $('#loading_city').addClass('display_none'); $('.owner_city .description').addClass('display_none'); } }, error: function() { console.info('error'); } }) .fail(function() { $( '.order_city_novaposhta .description' ).removeClass('display_none'); $( "#order_city_novaposhta" ).val(''); $('#loading_city').addClass('display_none'); }); $('#loading_city').removeClass('display_none'); }, minLength: 2, select: function( event, ui ) { $( "#order_city_novaposhta" ).val( ui.item.value ); $( "#order_city_ref" ).val( ui.item.ref ); $('#loading_city').addClass('display_none'); getNovaPoshtaOffice( ui.item.value ); return false; } }); } function getNovaPoshtaOffice( city ) { $('#loading_office').removeClass('display_none'); $.ajax( { url: '/ajax/get_offices/', data : { 'city' : city }, type : "POST", dataType: 'json', success: function (data) { var html = ''; if( data ) { for( var i in data ) { html += ''; } $('#store_address').html(html); $('#loading_office').addClass('display_none'); var option = $('select#store_address option:selected').data('store_ref'); $( "#order_store_address_ref").val($('select#store_address option:selected').data('store_ref')); $('#store_address').on( 'click', function() { $( "#order_store_address_ref").val($('select#store_address option:selected').data('store_ref')); }); } }, error: function() { console.info('error'); } }); } function add_item_for_compare( check, item_id ) { $.ajax( { url: '/ajax/add_item_for_compare', data : { 'check' : check, 'item_id' : item_id }, type : "POST", dataType: 'json', success: function (data) { var html = ''; if( data.length == 0 ) { $('.compare_wrapper').empty(); } else { var count = 0; html += ''+ ''+data[i]['description']+'
'+ 'м. Київ, ст.м. Лісова, пр-т Броварський, Торговий павільон "Професійне насіння" №25
'+ '9:00 - 19:00
'+ 'Пн-Сб
'+ 'написати нам'+ 'м. Київ, ст.м. Іподром, пр-т Академіка Глушкова, магазин "Професійне насіння" навпроти Південного автовокзалу
'+ '9:00 - 19:00
'+ 'Пн-Сб
'+ 'написати нам'+ 'м. Київ, вул. Харьківське шосе 166-В, біля магазину "Сільпо"
'+ '9:00 - 19:00
'+ 'Пн-Пт
'+ '9:00 - 18:00
'+ 'Сб-Нд
'+ 'написати нам'+ 'м. Київ, ст.м. Героїв Дніпра, пр-т Оболонський 43
'+ '9:00 - 19:00
'+ 'Вт-Нд
'+ 'написати нам'+ 'м. Київ вул.Садова 95
'+ '(дачний масив Осокорки)
'+ 'написати нам'+ 'м.Київ, вул.Віскозна 17/а
'+ 'ціна від '+data[i]['price2']+' грн
'+ 'Немає товарів за цим запитом
'); } }, error: function() { console.info('error'); } }) .fail(function() { }); $('#loading_city').removeClass('display_none'); }, minLength: 2, select: function( event, ui ) { //$( "#order_city_novaposhta" ).val( ui.item.value ); //$('#loading_city').addClass('display_none'); return false; } }); $(document).click(function(e) { var target = e.target; if ( !$(target).is('.search_result_wrapper') && !$(target).is('#search_item') ) { $('.site_search').removeClass('active'); } else { $('.site_search').addClass('active'); } }); /////////////////////////////////////////////////////////////////////// $('body').on('change','.one_item_compare', function() { var check = 0; var item_id = $(this).find('input').val(); if( $(this).find('input').prop('checked') ) { check = 1; } add_item_for_compare( check, item_id ); }); /////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////// $('.one_video_title').on( 'click', function(e) { //e.preventDefault(); var src = $(this).data('video_srs'); //$('.video_iframe').attr('src', src); }); /////////////////////////////////////////////////////////////////////// $(".carousel-demo1").sliderkit({ auto:false, shownavitems:6, circular:true }); var getTop = function(obj){ var height_odj = +obj.css('height').replace('px','') + 30; return height_odj; }; $('.question_mark').hover(function(){ var obj = $(this).siblings('.additional_info'); var new_top = getTop(obj); obj.css("top",'-'+new_top+'px'); obj.stop(false, true).fadeIn(300); }, function(){ $(this).siblings('.additional_info').stop(false, true).fadeOut(300); }); $('.additional_info').hover(function(){ $(this).stop(false, true).fadeIn(300); }, function(){ $(this).stop(false, true).fadeOut(300); }); if( $.cookie('sub-closed') !== '1' ) $('.subscription-wr-all').delay(29970).toggle(600); $('.sub-closed').click(function(){ $('.subscription-wr-all').toggle(450); $.cookie('sub-closed', '1', { expires: 1 }); }); var jVal = { 'fullName' : function() { var ele = $('#fullname'); if(ele.val().length < 2) { jVal.errors = true; $('.sub-sale-forma-blocks-name-first').removeClass('normal').addClass('wrong'); } else { $('.sub-sale-forma-blocks-name-first').removeClass('wrong').addClass('normal'); } }, 'email' : function() { var ele = $('#email'); var patt = /^.+@.+[.].{2,}$/i; if(!patt.test(ele.val())) { jVal.errors = true; $('.sub-sale-forma-blocks-name').removeClass('normal').addClass('wrong'); } else { $('.sub-sale-forma-blocks-name').removeClass('wrong').addClass('normal'); } }, 'sendIt' : function (){ if(!jVal.errors) { console.log('submit'); } } }; // ====================================================== // $('#send').click(function (e){ e.preventDefault(); e.stopPropagation(); jVal.errors = false; jVal.fullName(); jVal.email(); if(!jVal.errors ){ console.log('asdfsdfs'); eventMailer.email = $('#email').val(); eventMailer.name = $('#fullname').val(); eventMailer.event_type = 'add_subscribe'; eventMailer.event = 'registration_complete'; eventMailer.sendWithTimeOut(); $('.subscription-wr-all').fadeOut(); } }); $('#fullname').change(jVal.fullName); $('#email').change(jVal.email); }); function Counter (time, id, lang_id) { var clock = $(id).FlipClock(time, { clockFace: 'DailyCounter', countdown: true, autoStart: false }); clock.start(function () { }); $('.days .flip-clock-label').html('Днів'); $('.hours .flip-clock-label').html('Годин'); $('.minutes .flip-clock-label').html('Хвилин'); $('.seconds .flip-clock-label').html('Секунд'); }