var map; function mapInit() { var canvas = document.getElementById('map-canvas'); var coords = canvas.getAttribute('data-coords'); var commaPos = coords.indexOf(','); var lat = parseFloat(coords.substring(0, commaPos)); var lng = parseFloat(coords.substring(commaPos + 1, coords.length)); var myLatlng = new google.maps.LatLng(lat, lng); var mapOptions = { zoom: 15, center: myLatlng }; map = new google.maps.Map(canvas, mapOptions); var marker = new google.maps.Marker({ position: myLatlng, map: map }); } !function ($) { var $win = $(window); var $html = $('html'); var $body = $('body'); var $doc = $(document); $.widget( "custom.catcomplete", $.ui.autocomplete, { _renderMenu: function( ul, items ) { var that = this, currentCategory = ""; $.each( items, function( index, item ) { if ( item.category != currentCategory ) { ul.append( "
  • " + item.category + "
  • " ); currentCategory = item.category; } that._renderItemData( ul, item ); }); } }); $(function () { $('#reg_form').on('submit', function(){ var formData = $(this).serialize(); $.post('accounts/register/', formData, function(){ alert('success'); }); return false; }) /* Нестандартное оформление для поля select */ $.fn.customSelect = function () { return $(this).each(function() { var $this = $(this); var $options = $this.children('option'); var numberOfOptions = $this.children('option').length; var $selected = $(":selected", $this); // Hides the select element $this.addClass('s-hidden'); // Wrap the select element in a div $this.wrap('
    '); // Insert a styled div to sit over the top of the hidden select element $this.after('
    '); // Cache the styled div var $styledSelect = $this.next('div.custom-select-wrap'); var $styledSelectText = $styledSelect.children('.custom-select-text'); // Show the first select option in the styled div $styledSelectText.text($this.children('option').eq(0).text()); if ( $options.index($selected) == 0 && (!$this.children('option').eq(0).val() || !$this.children('option').eq(0).attr('value')) ) { $styledSelectText.addClass('placeholder'); } var $menu = $('
    ').insertAfter($styledSelect); var $optionsWrap = $menu.find('.scroll-content'); // Insert an unordered list after the styled div and also cache the list var $list = $('