%PDF- %PDF-
Direktori : /home/bitrix/www/bitrix/templates/UB/js/ |
Current File : /home/bitrix/www/bitrix/templates/UB/js/custom.js |
var PostRedirectMessages = { vacancy: L_MESS["PUBLICATION_OF_VACANCIES_IS_AVAILABLE"], offer: L_MESS["PUBLICATION_OF_OFFERS_IS_AVAILABLE"], profile: L_MESS["ONLY_REGISTERED_USERS_CAN_SEND_PRIVATE_MESSAGES"], profile_feedback: L_MESS["ONLY_REGISTERED_USERS_CAN_ADD_THE_REVIEWS"], blog_comment: L_MESS["ONLY_REGISTERED_USERS_CAN_ADD_THE_COMMENTS"], like: L_MESS["ONLY_REGISTERED_USERS_CAN_POST_LIKES"], }; function setCookie (name, value, expires, path, domain, secure) { document.cookie = name + "=" + escape(value) + ((expires) ? "; expires=" + expires : "") + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + ((secure) ? "; secure" : ""); } function getCookie(name) { var cookie = " " + document.cookie; var search = " " + name + "="; var setStr = null; var offset = 0; var end = 0; if (cookie.length > 0) { offset = cookie.indexOf(search); if (offset != -1) { offset += search.length; end = cookie.indexOf(";", offset) if (end == -1) { end = cookie.length; } setStr = unescape(cookie.substring(offset, end)); } } return(setStr); } function showAuthAlert(message) { $('#need_auth_form .need-auth-modal-body span#need-auth-message').text(PostRedirectMessages[message]); $('#need_auth_form').modal('show'); } function postRedirect(link,message) { if (IsAuthorized()) top.window.location = link; else showAuthAlert(message); } function show_auth_form(targetID) { $('#need_auth_form').modal('hide'); $(targetID).modal('show'); } function show_reg_form() { $('#auth_form').modal('hide'); $('#register_form').modal('show'); } function check_reg_form(f) { var isOk = true; // убираем обрезание слоя контейнера (что бы popover был виден) $('.regform-modal-body').css('overflow','visible'); // убираем все предупреждения $('form.register-page input[type!="hidden"],form.register-page select,'+ 'form.register-page input[type="checkbox"],form.register-page #usr_selector').popover('destroy'); // Проверяем обязательные поля ввода $('form.register-page input.form-control[type!="hidden"]').each(function(){ if ($(this).val().length < 3) { $(this).popover('show'); isOk = false; return false; } }); if (!isOk) return false; var regNumber = /\d/; // Проверяем пароль $('form.register-page input[name="REGISTER[PASSWORD]"]').each(function(){ if ($(this).val().length<6 || regNumber.exec($(this).val())<1 || $(this).val()==$('form.register-page input[name="REGISTER[EMAIL]"]').val()) { $(this).popover('show'); isOk = false; return false; } }); if (!isOk) return false; // Проверяем повтор пароля $('form.register-page input[name="REGISTER[CONFIRM_PASSWORD]"]').each(function(){ if ($(this).val()!=$('form.register-page input[name="REGISTER[PASSWORD]"]').val()) { $(this).popover('show'); isOk = false; return false; } }); if (!isOk) return false; // Проверяем выбор в select if ($('form.register-page select[name="UF_USR"] option:selected').attr('value')>0) console.log('profile type selected'); else { $('form.register-page #usr_selector').popover('show'); isOk = false; return false; } if (!isOk) return false; // Проверяем согласие на использование $('form.register-page input[type="checkbox"]').each(function(){ if (!$(this).prop('checked')) { $(this).popover('show'); isOk = false; return false; } }); if (!isOk) return false; return true; } function addFeedbackSubmitHandler() { // Обработчик отправки сообщения $('#main-feedback').find('form[name^="FEEDBACK_FORM"]').submit(function(e){ e.preventDefault(); var m_data=$(this).serialize()+'&web_form_submit='+$(this).find('input[name="web_form_submit"]').attr('value'); BX.ajax.post( $(this).attr('action'), m_data, function(data){ $('#main-feedback').find('.modal-body').html(data); $('#main-feedback').find('select').chosen({width: '100%', disable_search_threshold: 10}); // $('#main-feedback').find('.alert-danger').show(); addFeedbackSubmitHandler(); } ); }); } $(document).ready(function(){ var inv = Number($("#invite").attr("data-inv")); if (inv > 0){ var expinv = new Date(); expinv.setTime((new Date()).getTime()+100000000000); var expirinv = expinv.toGMTString(); setCookie('invite_id', inv, expirinv, '/'); }; $('#main-feedback-button').click(function(){ BX.ajax.get( L_MESS["SDIR"]+'feedback/feedback_ajax.php', function (data) { $('#main-feedback').find('.modal-body').html(data); $('#main-feedback').find('select').chosen({width: '100%', disable_search_threshold: 10}); $('#main-feedback').modal('show'); addFeedbackSubmitHandler(); } ); }); $('body').popover({ selector: 'form.register-page input[type!="hidden"],form.register-page select,'+ 'form.register-page input[type="checkbox"]', trigger: 'manual', placement: 'right', }); $('.popup_help').popover({ trigger: 'hover', placement: 'top', }); $(".our-clients .portfolio-item").hover( function() { $(this).find(".portfolio-item-title").show(); }, function() { $(this).find(".portfolio-item-title").hide(); } ); $('select[name="UF_USR"]').chosen({width: '100%;', disable_search_threshold: 10}); }); /*----------------------------------------------------*/ /* Search box expand Section /*----------------------------------------------------*/ jQuery(document).ready(function () { jQuery(".search-text-box").focus(function(){ //jQuery("ul.social").animate({ marginLeft: "-120px"}, 450, "easeInSine") }); /*----------------------------------------------------*/ /* Keyframe animations enable /*----------------------------------------------------*/ jQuery().waypoint && jQuery("body").imagesLoaded(function () { jQuery(".animate_afc, .animate_afl, .animate_afr, .animate_aft, .animate_afb, .animate_wfc, "+ ".animate_hfc, .animate_rfc, .animate_rfl, .animate_rfr").waypoint(function () { if (!jQuery(this).hasClass("animate_start")) { var e = jQuery(this); setTimeout(function () { e.addClass("animate_start") }, 20) } }, { offset: "85%", triggerOnce: !0 }) }); /*----------------------------------------------------*/ /* Superfish Mainmenu Section /*----------------------------------------------------*/ jQuery(function () { jQuery('ul.sf-menu').stop().superfish(); }); /*----------------------------------------------------*/ /* Slider Nav Arrow Show Hide /*----------------------------------------------------*/ jQuery('.slider-wrapper').hover(function () { jQuery('.nivo-prevNav').stop().animate({ "opacity": 0.3 }, 'easeIn'); jQuery('.nivo-nextNav').stop().animate({ "opacity": 0.3 }, 'easeIn'); }, function () { jQuery('.nivo-prevNav').stop().animate({ "opacity": 0 }, 'easeIn'); jQuery('.nivo-nextNav').stop().animate({ "opacity": 0 }, 'easeIn'); }); /*----------------------------------------------------*/ /* Accordion Section /*----------------------------------------------------*/ jQuery('.accordionMod').each(function (index) { var thisBox = jQuery(this).children(), thisMainIndex = index + 1; jQuery(this).attr('id', 'accordion' + thisMainIndex); thisBox.each(function (i) { var thisIndex = i + 1, thisParentIndex = thisMainIndex, thisMain = jQuery(this).parent().attr('id'), thisTriggers = jQuery(this).find('.accordion-toggle'), thisBoxes = jQuery(this).find('.accordion-inner'); jQuery(this).addClass('panel'); thisBoxes.wrap('<div id=\"collapseBox' + thisParentIndex + '_' + thisIndex + '\" class=\"panel-collapse collapse\" />'); thisTriggers.wrap('<div class=\"panel-heading\" />'); thisTriggers.attr('data-toggle', 'collapse').attr('data-parent', '#' + thisMain).attr('data-target', '#collapseBox' + thisParentIndex + '_' + thisIndex); }); jQuery('.accordion-toggle').prepend('<span class=\"icon\" />'); jQuery("div.accordion-item:first-child .accordion-toggle").addClass("current"); jQuery("div.accordion-item:first-child .icon").addClass("iconActive"); jQuery("div.accordion-item:first-child .panel-collapse").addClass("in"); jQuery('.accordionMod .accordion-toggle').click(function () { if (jQuery(this).parent().parent().find('.panel-collapse').is('.in')) { jQuery(this).removeClass('current'); jQuery(this).find('.icon').removeClass('iconActive'); } else { jQuery(this).addClass('current'); jQuery(this).find('.icon').addClass('iconActive'); } jQuery(this).parent().parent().siblings().find('.accordion-toggle').removeClass('current'); jQuery(this).parent().parent().siblings().find('.accordion-toggle > .icon').removeClass('iconActive'); }); }); }); /*----------------------------------------------------*/ /* Nivo Slider /*----------------------------------------------------*/ /* jQuery(window).load(function() { jQuery('#nivoslider').nivoSlider({ effect: 'fade', // Specify sets like: 'fold,fade,sliceDown' slices: 15, // For slice animations boxCols: 8, // For box animations boxRows: 4, // For box animations animSpeed: 800, // Slide transition speed pauseTime: 8000, // How long each slide will show startSlide: 0, // Set starting Slide (0 index) directionNav: true, // Next & Prev navigation controlNav: false, // 1,2,3... navigation controlNavThumbs: false, // Use thumbnails for Control Nav pauseOnHover: true, // Stop animation while hovering manualAdvance: false, // Force manual transitions prevText: '', // Prev directionNav text nextText: '', // Next directionNav text randomStart: false, // Start on a random slide beforeChange: function(){}, // Triggers before a slide transition afterChange: function(){}, // Triggers after a slide transition slideshowEnd: function(){}, // Triggers after all slides have been shown lastSlide: function(){}, // Triggers when last slide is shown afterLoad: function(){} // Triggers when slider has loaded }); }); */ /*----------------------------------------------------*/ /* Carousel Section /*----------------------------------------------------*/ jQuery('.portfolio-carousel').carousel({interval: false, wrap: false}); jQuery('.client-carousel').carousel({interval: false, wrap: false}); jQuery('.testimonials-carousel').carousel({interval: 5000, pause: "hover"}); /*----------------------------------------------------*/ /* Hover Overlay /*----------------------------------------------------*/ jQuery(document).ready(function () { /* jQuery('.portfolio-item').hover(function () { jQuery(this).find( '.portfolio-item-hover' ).animate({"opacity": 0.8}, 100, 'easeInOutCubic'); }, function () { jQuery(this).find( '.portfolio-item-hover' ).animate({"opacity": 0}, 100, 'easeInOutCubic'); }); jQuery('.portfolio-item').hover(function () { jQuery(this).find(".fullscreen").stop().animate({'top' : '60%', 'opacity' : 1}, 250, 'easeOutBack'); }, function () { jQuery(this).find(".fullscreen").stop().animate({'top' : '65%', 'opacity' : 0}, 150, 'easeOutBack'); }); */ /* Post Image overlay */ jQuery('.post-image').hover(function () { jQuery(this).find( '.img-hover' ).animate({"opacity": 0.8}, 100, 'easeInOutCubic'); }, function () { jQuery(this).find( '.img-hover' ).animate({"opacity": 0}, 100, 'easeInOutCubic'); }); jQuery('.post-image').hover(function () { jQuery(this).find(".fullscreen").stop().animate({'top' : '55%', 'opacity' : 1}, 250, 'easeOutBack'); }, function () { jQuery(this).find(".fullscreen").stop().animate({'top' : '65%', 'opacity' : 0}, 150, 'easeOutBack'); }); jQuery('.blog-showcase ul li').each(function () { jQuery(this).hover(function () { console.dir($(this)); jQuery(this).siblings('li').removeClass('blog-first-el').end().addClass('blog-first-el'); }); }); /* jQuery('.blog-showcase-thumb').hover(function () { jQuery(this).find( '.post-item-hover' ).animate({"opacity": 0.8}, 100, 'easeInOutCubic'); }, function () { jQuery(this).find( '.post-item-hover' ).animate({"opacity": 0}, 100, 'easeInOutCubic'); }); jQuery('.blog-showcase-thumb').hover(function () { jQuery(this).find(".fullscreen").stop().animate({'top' : '57%', 'opacity' : 1}, 250, 'easeOutBack'); }, function () { jQuery(this).find(".fullscreen").stop().animate({'top' : '65%', 'opacity' : 0}, 150, 'easeOutBack'); }); */ /* Mobile device topnav opener */ /* jQuery( ".down-button" ).click(function() { jQuery( ".down-button .icon-current" ).toggleClass("fa fa-angle-up fa fa-angle-down"); }); */ /*----------------------------------------------------*/ /* Parallax section /*----------------------------------------------------*/ jQuery('.product-lead').parallax("50%", 0.1); jQuery('.our-clients').parallax("50%", 0.1); jQuery('.service-reasons').parallax("50%", 0.1); /*----------------------------------------------------*/ /* Tootltip Initialize /*----------------------------------------------------*/ jQuery("[data-toggle='tooltip']").tooltip(); }); /*----------------------------------------------------*/ /* Sticky Menu /*----------------------------------------------------*/ /* jQuery(document).ready(function(){ jQuery(".top-bar").sticky({topSpacing:0}); }); */ /*----------------------------------------------------*/ /* Scroll To Top Section /*----------------------------------------------------*/ jQuery(document).ready(function () { jQuery(window).scroll(function () { if (jQuery(this).scrollTop() > 100) { jQuery('.scrollup').fadeIn(); } else { jQuery('.scrollup').fadeOut(); } }); jQuery('.scrollup').click(function () { jQuery("html, body").animate({ scrollTop: 0 }, 600); return false; }); }); /*----------------------------------------------------*/ /* Tabs Control Section /*----------------------------------------------------*/ var ht_tabinit = $('#horizontal-tabs > ul > li[data-name="'+window.location.hash+'"]').attr('ID'); if ((typeof ht_tabinit !=="undefined") && ht_tabinit) { ht_tabinit = ht_tabinit.substring(3); } else ht_tabinit = 1; $('#horizontal-tabs > ul > li').click(function(){ window.location.hash = $(this).attr('data-name'); }); jQuery("#horizontal-tabs").tytabs({ tabinit: ht_tabinit, fadespeed: "fast" }); jQuery("#horizontal-tabs.two").tytabs({ tabinit: "1", prefixtabs: "tab_two", prefixcontent: "content_two", fadespeed: "fast" }); jQuery("#horizontal-tabs.three").tytabs({ tabinit: "1", prefixtabs: "tab_three", prefixcontent: "content_three", fadespeed: "fast" }); jQuery("#horizontal-tabs.four").tytabs({ tabinit: "1", prefixtabs: "tab_four", prefixcontent: "content_four", fadespeed: "fast" }); jQuery("#horizontal-tabs.five").tytabs({ tabinit: "1", prefixtabs: "tab_five", prefixcontent: "content_five", fadespeed: "fast" }); jQuery("#vertical-tabs").tytabs({ tabinit: "1", prefixtabs: "tab_v", prefixcontent: "content_v", fadespeed: "fast" }); jQuery("#vertical-tabs.two").tytabs({ tabinit: "1", prefixtabs: "tab_v_two", prefixcontent: "content_v_two", fadespeed: "fast" }); jQuery("#vertical-tabs.three").tytabs({ tabinit: "1", prefixtabs: "tab_v_three", prefixcontent: "content_v_three", fadespeed: "fast" }); jQuery("#vertical-tabs.four").tytabs({ tabinit: "1", prefixtabs: "tab_v_four", prefixcontent: "content_v_four", fadespeed: "fast" }); jQuery("#vertical-tabs.five").tytabs({ tabinit: "1", prefixtabs: "tab_v_five", prefixcontent: "content_v_five", fadespeed: "fast" }); jQuery(".hideit").click(function () { e(this).fadeOut(600) }); jQuery("#toggle-view li h4").click(function () { var t = e(this).siblings("div.panel"); if (t.is(":hidden")) { t.slideDown("200"); e(this).siblings("span").html("-") } else { t.slideUp("200"); e(this).siblings("span").html("+") } }); jQuery(function (jQuery) { jQuery("#example").popover(); jQuery("#example_left").popover({ placement: 'left' }); jQuery("#example_top").popover({ placement: 'top' }); jQuery("#example_bottom").popover({ placement: 'bottom' }); }); /*----------------------------------------------------*/ /* Query String Parser /*----------------------------------------------------*/ (function($) { $.QueryString = (function(a) { if (a == "") return {}; var b = {}; for (var i = 0; i < a.length; ++i) { var p=a[i].split('='); if (p.length != 2) continue; b[p[0]] = decodeURIComponent(p[1].replace(/\+/g, " ")); } return b; })(window.location.search.substr(1).split('&')) })(jQuery); /*----------------------------------------------------*/ /* Other Custom /*----------------------------------------------------*/ $(document).ready(function(){ if (($("form.login-page input#auth_error").val()=='Y' && $('form.login-page input[name="TYPE"]').val()=='AUTH') || $("#need_auth").val()=='Y') $("#auth_form").modal('show'); if ($(".portfolio_forbutton")) { c_el = $(".portfolio_forbutton").length; $(".portfolio_forbutton").eq(c_el-1).css("border", "none"); } if ($('#reg_errors').text()=="1") { $("#register_form").modal('show'); } /* ========================================================================== Placeholer for IE ========================================================================== */ $('.form-control').placeholder(); });