var cbWidgetYandexCounterId = null; var cbWidgetMainTimeout = setTimeout(cbWidgetShowCallDialog, 30 * 1000); var cbDefaultWidgetInputSelector = '#cb_widget_input'; var cbIsOffline = true; function initYandexCounter() { var SMHtml=document.documentElement.innerHTML; var re = /Ya\.Metrika\({[\s\S]*id:(\d+)/i; var found = SMHtml.match(re); if (found+'' !== 'null'){ cbWidgetYandexCounterId = found[1]; } } function cbWidgetYandexCounterGoal(name) { if ( cbWidgetYandexCounterId !== null ) { eval('yaCounter'+cbWidgetYandexCounterId+'.reachGoal(\''+name+'\');'); } } function cbWidgetMainButtonOnClick() { cbWidgetShowCallDialog(); cbWidgetYandexCounterGoal('CALLBACK_WIDGET_CLICK'); } function cbWidgetShowCallDialog() { var noOtherPopups = (typeof window.popupIsActive === 'undefined'); clearTimeout(cbWidgetMainTimeout); if (noOtherPopups) { $('#cb_widget_popup').fadeIn(300); } } function cbWidgetCloseCallDialog() { $('#cb_widget_popup').fadeOut(300); } function cbWidgetSubmitPhone(number) { if ( cbIsOffline === true ) { cbWidgetSendOfflineCallRequest(number); } else { cbWidgetSendCallRequest(number); } } function cbWidgetSendCallRequest(cbPhone) { if (cbPhone != null && cbPhone !== "") { $.ajax({ method: "POST", crossDomain: true, cache: false, timeout: 8000, dataType: "jsonp", url: "//callback.onmaster.ru/core?action=call&key=dg4y9wegkjfevbxuf0043564gg4edsds&number="+cbPhone, error : function(jqXHR, textStatus, errorThrown) { alert("Ошибка, попробуйте еще раз. (" + textStatus + ":" + errorThrown + ")"); }, success: function(response) { $('#cb_widget_popup #cb_popup_content').html(response.Message); cbWidgetYandexCounterGoal('CALLBACK_WIDGET_ORDER_CALL'); }, }) } } function cbWidgetSendOfflineCallRequest(cbPhone) { if (cbPhone != null && cbPhone !== "") { $.ajax({ method: "POST", crossDomain: true, cache: false, timeout: 8000, dataType: "jsonp", url: "//callback.onmaster.ru/core?action=offlinecall&key=dg4y9wegkjfevbxuf0043564gg4edsds&number="+cbPhone, error : function(jqXHR, textStatus, errorThrown) { alert("Ошибка, попробуйте еще раз. (" + textStatus + ":" + errorThrown + ")"); }, success: function(response) { $('#cb_widget_popup #cb_popup_content').html(response.Message); cbWidgetYandexCounterGoal('CALLBACK_WIDGET_ORDER_CALL_OFFLINE'); }, }) } } document.write(''); $('body').append('
'); $('body').append('