integration/v2/js/main.js
changeset 188 aa163c5df6e3
parent 187 be4eb4db3418
parent 185 5f265e870a8d
child 219 6667fb5455d0
equal deleted inserted replaced
187:be4eb4db3418 188:aa163c5df6e3
     1 $(function(){
     1 $(function(){
     2 //filters
     2 
     3 	$('.filters a').each(function(){
       
     4 		var text = $.trim($(this).text());
       
     5 		if(text.length > 26){
       
     6 			$(this).text(text.substr(0, 26) + '...')
       
     7 		}
       
     8 	});
       
     9 //masonry
     3 //masonry
    10 	var masonry465 = $('.masonry-465');
     4 	var masonry465 = $('.masonry-465');
    11 	masonry465.masonry({
     5 	masonry465.masonry({
    12 	  columnWidth: 465,
     6 	  columnWidth: 465,
    13 	  itemSelector: '.item-masonry',
     7 	  itemSelector: '.item-masonry',
    51 			var tag = $(this).attr('data-tag');
    45 			var tag = $(this).attr('data-tag');
    52 			keywordsTagIt.tagit("createTag", tag);
    46 			keywordsTagIt.tagit("createTag", tag);
    53 		});
    47 		});
    54 	}
    48 	}
    55 
    49 
    56 //map
    50 
       
    51 	
       
    52 	// add item to collection behaviour
       
    53 	$('.additemtocollection').bind('click', function(e){
       
    54 		// When an item meant to be added to a collection is clicked,
       
    55 		// we fill the form in the add-to-collection div
       
    56 		console.log(this + ", " + $(this) + ", " + $(this).attr('data-type') + ", " + $(this).attr('data-id'));
       
    57 		$('#add-to-collection .item-type').val($(this).attr('data-type'));
       
    58 		$('#add-to-collection .item-id').val($(this).attr('data-id'));
       
    59 	});
       
    60 	
       
    61 	
       
    62 
    57 	if($('#map').length){
    63 	if($('#map').length){
    58 		initmap()
    64 		initmap()
    59 	}
    65 	}
    60 function initmap() {
    66 	function initmap() {
    61 	// set up the map
    67 		// set up the map
    62 	map = new L.Map('map');
    68 		map = new L.Map('map');
    63 
    69 
    64 	// create the tile layer with correct attribution
    70 		// create the tile layer with correct attribution
    65 	var osmUrl='http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png';
    71 		var osmUrl='http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png';
    66 	var osm = new L.TileLayer(osmUrl, {minZoom: 3, maxZoom: 20});		
    72 		var osm = new L.TileLayer(osmUrl, {minZoom: 3, maxZoom: 20});		
    67 
    73 
    68 	// start the map in South-East England
    74 		// start the map in South-East England
    69 	map.setView(new L.LatLng(48.833, 2.333),4);
    75 		map.setView(new L.LatLng(48.833, 2.333),4);
    70 	map.addLayer(osm);
    76 		map.addLayer(osm);
    71 
    77 
    72 	// markers
    78 		// markers
    73 	var marker1 = L.marker([48.833, 2.333]).addTo(map);
    79 		var marker1 = L.marker([48.833, 2.333]).addTo(map);
    74 	marker1.bindPopup("Beaux-Arts de Paris");
    80 		marker1.bindPopup("Beaux-Arts de Paris");
    75 	var marker2 = L.marker([47.233,-1.583]).addTo(map);
    81 		var marker2 = L.marker([47.233,-1.583]).addTo(map);
    76 	marker2.bindPopup("Beaux-Arts de Nantes");
    82 		marker2.bindPopup("Beaux-Arts de Nantes");
    77 }
    83 	}
    78 
    84 
    79 });//ready
    85 });//ready