Advertisement
Dimalolzet

Untitled

May 12th, 2016
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. bindNav = function() {
  2.     'use strict';
  3.     var $button, $introContent, $nav;
  4.     $button = $('.nav-button');
  5.     $nav = $('.nav');
  6.     $introContent = $('.intro__content');
  7.     return $button.click(function() {
  8.         $nav.slideToggle();
  9.         return $introContent.toggleClass('intro__content_indent');
  10.     });
  11. };
  12.  
  13.  
  14.  
  15.  
  16.  
  17. bindCatalog = function() {
  18.     'use strict';
  19.     var $catalog, $catalogItem, $catalogOpener, $catalogSection, bind, bindCatalogShowing, bindOnClick, bindOnHover, catalogOpenerActiveClass, mobile, openItemClass, unbind;
  20.     $catalog = $('.catalog');
  21.     $catalogItem = $('.catalog__item');
  22.     $catalogOpener = $('.catalog-opener');
  23.     $catalogSection = $('.catalog-section');
  24.     openItemClass = 'catalog__item_open';
  25.     catalogOpenerActiveClass = 'catalog-opener_active';
  26.     mobile = windowWidth <= 992;
  27.     bindCatalogShowing = function() {
  28.         var SPACE, pullLeftClass;
  29.         pullLeftClass = 'catalog_pull-left';
  30.         SPACE = 50;
  31.         $catalogOpener.mouseenter(function() {
  32.             var $container, $currentCatalog, $subcatalog, catalogFullWidth, itemOffset;
  33.             $currentCatalog = $(this).find($catalog);
  34.             $subcatalog = $currentCatalog.find('.subcatalog').first();
  35.             $container = $(this).closest('.catalog-container');
  36.             if ($currentCatalog.length) {
  37.                 $(this).addClass(catalogOpenerActiveClass);
  38.                 itemOffset = $(this).position().left - $container.position().left;
  39.                 catalogFullWidth = itemOffset + ($currentCatalog.width() + $subcatalog.width());
  40.                 if ($container.width() - catalogFullWidth - SPACE < 0) {
  41.                     return $currentCatalog.addClass(pullLeftClass);
  42.                 }
  43.             }
  44.         });
  45.         return $catalogOpener.mouseleave(function() {
  46.             $(this).removeClass(catalogOpenerActiveClass);
  47.             return $catalog.removeClass(pullLeftClass);
  48.         });
  49.     };
  50.     unbind = function() {
  51.         $catalog.unbind();
  52.         $catalogItem.unbind();
  53.         $catalogOpener.unbind();
  54.         $catalogSection.find('a').unbind();
  55.         return $('.' + openItemClass).removeClass(openItemClass);
  56.     };
  57.     bindOnHover = function() {
  58.         bindCatalogShowing();
  59.         $($catalogSection).find('ul').css('display', '');
  60.         return $catalog.menuAim({
  61.             activate: function(item) {
  62.                 return $(item).addClass(openItemClass);
  63.             },
  64.             deactivate: function(item) {
  65.                 return $(item).removeClass(openItemClass);
  66.             },
  67.             exitMenu: function() {
  68.                 return $('.' + openItemClass).removeClass(openItemClass);
  69.             }
  70.         });
  71.     };
  72.     bindOnClick = function() {
  73.         $('.catalog-button').click(function() {
  74.             return $('.catalog-container').slideToggle();
  75.         });
  76.         return $catalogSection.find('li').click(function(e) {
  77.             var $targetMenu;
  78.             if (!$(e.target).closest('.menu__link').length) {
  79.                 $targetMenu = $(this).find('> ul');
  80.                 if ($targetMenu.length) {
  81.                     $('.' + $(this).parent().find('ul').attr('class')).not($targetMenu).slideUp();
  82.                     return $targetMenu.slideToggle();
  83.                 }
  84.             }
  85.         });
  86.     };
  87.     bind = function() {
  88.         unbind();
  89.         if (mobile) {
  90.             return bindOnClick();
  91.         } else {
  92.             return bindOnHover();
  93.         }
  94.     };
  95.     bind();
  96.     return $(window).resize(function() {
  97.         if (mobile !== (windowWidth <= 992)) {
  98.             mobile = windowWidth <= 992;
  99.             return bind();
  100.         }
  101.     });
  102. };
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110. window.initMap = function() {
  111.     'use strict';
  112.     var $mapContainer, center, map, marker;
  113.     $mapContainer = $('#map');
  114.     center = {};
  115.     if (!$mapContainer.length) {
  116.         return false;
  117.     }
  118.     if ($mapContainer.closest('.map').hasClass('map_full')) {
  119.         center = {
  120.             lat: 53.933000,
  121.             lng: 27.593500
  122.         };
  123.     } else {
  124.         center = {
  125.             lat: 53.934100,
  126.             lng: 27.590000
  127.         };
  128.     }
  129.     map = new google.maps.Map($mapContainer[0], {
  130.         center: center,
  131.         zoom: 17,
  132.         scrollwheel: false,
  133.         mapTypeControl: false,
  134.         zoomControl: true,
  135.         zoomControlOptions: {
  136.             position: google.maps.ControlPosition.RIGHT_TOP
  137.         },
  138.         scaleControl: true,
  139.         streetViewControl: true,
  140.         streetViewControlOptions: {
  141.             position: google.maps.ControlPosition.RIGHT_TOP
  142.         },
  143.         styles: [{
  144.             'featureType': 'all',
  145.             'elementType': 'all',
  146.             'stylers': [{
  147.                 'saturation': -50
  148.             }, {
  149.                 'lightness': 30
  150.             }]
  151.         }]
  152.     });
  153.     marker = new google.maps.Marker({
  154.         position: {
  155.             lat: 53.934650,
  156.             lng: 27.593650
  157.         },
  158.         map: map,
  159.         title: 'Аквамарин',
  160.         icon: new google.maps.MarkerImage('img/map-marker.png', new google.maps.Size(324, 234), new google.maps.Point(0, 0), new google.maps.Point(157, 60)),
  161.         animation: google.maps.Animation.DROP
  162.     });
  163.     return marker.addListener('click', function() {
  164.         var win;
  165.         win = window.open('https://goo.gl/maps/cKskvzekppR2', '_blank');
  166.         return win.focus();
  167.     });
  168. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement