var map = null; var currentObj = null; function imageMapInit(lat, lng, zoom) { map = new L.Map('map_canvas', {center: new L.LatLng(lat, lng), zoom: zoom, maxZoom: 19}); map.addControl(new L.Control.Layers({ 'OSM': new L.DeferredLayer(layerdefs.osm), 'Yandex Map': new L.DeferredLayer(layerdefs.ymap), 'Yandex Satellite': new L.DeferredLayer(layerdefs.ysat), 'Yandex Hybrid': new L.DeferredLayer(layerdefs.yhyb), 'Yandex Народная': new L.DeferredLayer(layerdefs.ypub), 'Yandex Народная Hybrid': new L.DeferredLayer(layerdefs.ypubhyb), 'Google Roadmap': new L.DeferredLayer(layerdefs.groad), 'Google Terrain': new L.DeferredLayer(layerdefs.gter), 'Google Satellite': new L.DeferredLayer(layerdefs.gsat), 'GoogleHybrid': new L.DeferredLayer(layerdefs.ghyb), 'Bing Road': new L.DeferredLayer(layerdefs.broad), 'Bing Aerial': new L.DeferredLayer(layerdefs.baer), 'Bing Aerial With Labels': new L.DeferredLayer(layerdefs.baerlab), 'MapQuest': new L.DeferredLayer(layerdefs.mqst) })); map.addControl(new L.Control.Scale({width: 100, position: 'bottomleft'})); var fullScreen = new L.Control.FullScreen(); map.addControl(fullScreen); $('.leaflet-control-zoom').parent().removeClass('leaflet-left').addClass('leaflet-right'); var count = 1; // 0 - not set $('#map_canvas .leaflet-control-layers-base input:radio') .each(function(){ $(this).val(count); count++; }); map.on('enterFullscreen exitFullscreen', function(){ setTimeout(function(){map.invalidateSize()}, 1000); }); $('#map_canvas .leaflet-control-layers-list input:radio').checkbox({cls:'jquery-radiobutton-white',empty: '/skin/images/empty.png'}); $('#map_canvas .jquery-radiobutton-white').hover(function(){ $('#map_canvas .leaflet-control-layers').addClass('leaflet-control-layers-expanded'); }, function(){ $('#map_canvas .leaflet-control-layers').removeClass('leaflet-control-layers-expanded'); }); } jQuery(function($) { $('#serverURL').text(window.location.href); $('#clipboardCopy').zclip({ path:'/skin/js/ZeroClipboard.swf', copy:function(){return $('#serverURL').text();}, clickAfter: false, setHandCursor: true, afterCopy: function(){ flushSpinnerMessage(Travvi.s('js.code_copied_in_clipboard')); } }); imageMapInit(0, 0, 1); $('.locationPopupCaller').click(function() { $('#dialog-map').dialog('open'); var obj = $(this); if (obj.data('map_type')) { $('#dialog-map .leaflet-control-layers-base input:radio').each(function(){ if($(this).val() == type) $(this).click(); }); } else { $('#dialog-map .leaflet-control-layers-base input:radio').first().click(); } map.setView(new L.LatLng(obj.data('latitude'), obj.data('longitude')), obj.data('scale')); return false; }); $('#dialog-map').dialog({ autoOpen: false, width: 'auto', position: ['center', 'center'], height: 'auto', modal: true, resizable: false, draggable: false, open: function(){ $('#dialog-map').dialog('option', { width: Math.max(Math.min($(window).width() - 100, 900), 480), height: Math.max(Math.min($(window).height() - 100, 600), 360) }).dialog('option', {position: ['center', 'center']}); map.invalidateSize(); } }); $('#profile a.add').tooltip({showURL: false}).click(function(){ if($(this).hasClass('active')) return false; currentObj = $(this); $('#dialog-skillForm').dialog('open'); return false; }); $('#dialog-skillForm').dialog({ autoOpen: false, width: 374, position: ['center', 'center'], height: 'auto', modal: true, resizable: false, draggable: false, open: function(){ $('#hobbyName').text(currentObj.parent().find('span.name').text()); } }); $('#dialog-skillForm a').button(); $('#dialog-skillForm select').selectik({width: 300}); $('#dialog-skillForm a.cancel').click(function(){ $('#dialog-skillForm').dialog('close'); return false; }); $('#dialog-skillForm a.ok').click(function(){ $('#dialog-skillForm').dialog('close'); var successfullyAdded = false; $.ajax({ url: '/interests/add', type: 'post', data: { hobbyId: currentObj.data('hobby_id'), skillId: $('#skillId').val()}, cache: false, success: function(data) { eval(data); if(successfullyAdded) { $.each(ids, function(key, value){ current = $('#hobbies_'+value); current.parent().find('a.add').addClass('active').tooltip({bodyHandler: function() { return Travvi.s('js.in_my_hobbies'); }, showURL: false}); current.parent().find('a.delete').addClass('notClickable').tooltip({bodyHandler: function() { return Travvi.s('js.in_my_hobbies'); }, showURL: false}); }); } } }); return false; }); $('a.bang').tooltip({showURL: false}).click(function(){ return false; }); });