<commit_before><html>
<head>	
	<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">	
	<%= stylesheet_link_tag 'new_welcome' %> 
	<link href='https://fonts.googleapis.com/css?family=PT+Sans' rel='stylesheet' type='text/css'>
	<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
	<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<!-- Google maps include -->
  <script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCCeenRdnkY-eXliSSYWMykY8-AzO_z5aM" type="text/javascript"></script>
	<%= javascript_include_tag 'isotope.pkgd.min' %>
	<%= javascript_include_tag 'wax.g' %>
  <%= javascript_include_tag "i18n" %>
  <%= javascript_include_tag "translations" %>
<script>
	function toggleHeaderSubnav(link) {
	  if ($(link).parents('.subnavtab').hasClass('open')) {
	    closeHeaderSubnav(link);
	  } else {
	    openHeaderSubnav(link);
	  }
	}

	function openHeaderSubnav(link) {
	  $('.subnav').hide();
	  $('.subnavtab').removeClass('open');
	  $(link).parents('.subnavtab').addClass('open');
	  $(link).parents('li').find('.subnav').show();
	  $(document).click(subnavClickOff);
	}

	function closeHeaderSubnav(link) {
	  $(link).parents('.subnavtab').removeClass('open');
	  $(link).parents('li').find('.subnav').hide();
	  $(document).unbind('click', subnavClickOff);
	}

	function subnavClickOff(e) {
	  if ($(e.target).parents('.subnavwrapper').length == 0) {
	    $('.subnav').hide();
	    $('.subnavtab').removeClass('open');
	  }
	}
</script>
<script>
	$(document).ready(function(){
    window.observations = <%=json_escape @observations.to_json( :include => { :observation_photos => { :include => { :photo => { :except => :metadata } } } }).html_safe %>;

    var infoWindow;

    var map = new google.maps.Map(document.getElementById('map'), {
      center: {lat: -34.397, lng: 150.644},
      zoom: 9,
      maxZoom: 13,
      minZoom: 9
    });
    
    var features = [];
    if(observations){
      for(var i = 0; i < observations.length; i++){
        var obs_n = observations[i];
        var marker = new google.maps.Marker({
          position: {lat: parseFloat(obs_n.latitude), lng: parseFloat(obs_n.longitude)},
          icon: "<%= image_url("mapMarkers/natusfera-marker-mini.png") %>"
        });
        features.push({ marker: marker, observation: obs_n  });
      } 
    }

    var tile_server_url = <%= CONFIG.tile_servers.windshaft.inspect.html_safe %>;
    //var tile_server_url = "http://192.168.127.12:4000";

	  var tilejson = {
			tiles : [tile_server_url + "/observations/points/{z}/{x}/{y}.png?"],
			grids: [tile_server_url + "/observations/points/{z}/{x}/{y}.grid.json?&interactivity=id,taxon_id,species_guess,latitude,longitude,positional_accuracy,captive,quality_grade,iconic_taxon_id"],
			template : "{{species_guess}}",
			interactivity : "id,taxon_id,species_guess,latitude,longitude,positional_accuracy,captive,quality_grade,iconic_taxon_id"	
		};

		var interactionlayer = new wax.g.connector( tilejson );

		map.overlayMapTypes.push(interactionlayer);

    wax.g.interaction().map(map).tilejson(tilejson)
    .on({
      on: function(o) {
        document.body.style.cursor = 'pointer'
        if (o.e.type == 'click') {
          // if the click is anywhere within the InfoWindow, don't act on it
          if($('.gm-style-iw').parent().find(o.e.target).length > 0) { return false; }
          if(o.data['latitude']){
            var latLng = new google.maps.LatLng(o.data['latitude'],o.data['longitude']);
            $.ajax({
              url:  '/observations/' + o.data['id'] + '.html?partial=cached_component',              
              //url:  '/observations/132.html?partial=cached_component',
              type: 'GET',
              dataType: 'html',
              beforeSend: function() {
                var iw = getInfoWindow();
                iw.position = latLng;                
                iw.setContent($('<div class="loading status">Loading...</div>').get(0));
                iw.open(map);                
              },
              success: function(data) {
                var iw = getInfoWindow()
                iw.position = latLng;                
                iw.setContent($('<div class="compact mini infowindow observations"></div>').append(data).get(0));
                iw.open(map);
                // make sure the InfoWindow has focus
                $(iw).focus();                
              },
              error: function(jqXHR, textStatus, errorThrown) {
                console.log(textStatus);
              }
            });
          }
        } else if (o.e.type == 'mousemove') {
          map.setOptions({ draggableCursor: 'pointer' });
        }
      },
      off: function(o) {
        map.setOptions({ draggableCursor: 'url(http://maps.google.com/mapfiles/openhand.cur), move' });
      }
    });
    var data_slice_to_html = function(data_slice){
      var retVal = "<a class=\"username_label\" href=\"" + data_slice.url + "\">" + data_slice.name + "</a> - <a class=\"species_label\" href=\"" + data_slice.especie_url + "\">" + data_slice.especie + "</a>";
      if(data_slice.place_guess_url){
        retVal = retVal + ", " + data_slice.place_guess_url;
      }
      return retVal;
    }

    var activate_locale_link = function(locale){
      var control = $("#locale_" + locale);
      if(control){
        $(".locale_link").removeClass("active");
        control.addClass("active");
      }
    }

    var init_locale = '<%= I18n.locale %>';

    if(init_locale && init_locale != ''){
      activate_locale_link(init_locale);
    }

    obs_data_slider = [];
    <% for observation in @observations %>
      var obs_<%= observation.id %> = {};
      <% if observation.user.name and observation.user.name != ''%>
      obs_<%= observation.id %>.name = '<%= observation.user.name.html_safe %>';
      <% else %>
      obs_<%= observation.id %>.name = '<%= observation.user.login.html_safe %>';
      <% end %>
      obs_<%= observation.id %>.url = '<%= observations_by_login_url(observation.user.login) %>';
      <% unless observation.species_guess.blank? %>
        obs_<%= observation.id %>.especie = '<%= observation.species_guess.html_safe %>';
      <% else %>
        obs_<%= observation.id %>.especie = '<%=t :something %>';
      <% end %>
      obs_<%= observation.id %>.especie_url = '<%= observation_path(observation) %>';
      obs_data_slider[<%= observation.id %>] = obs_<%= observation.id %>;

      obs_<%= observation.id %>.place_guess_url = '<%= observation_place_guess(observation).html_safe %>';
    <% end %>
    var getItemId = function(id){
      return parseInt(id.substring(id.indexOf("_")+1));
    };

    var clearMarkers = function(){
      for(var i = 0; i < features.length; i++){
        features[i].marker.setMap(null);
      }
    };
    var setCurrentMarker = function(marker){
      clearMarkers();
      marker.setMap(map);
      map.panTo(marker.getPosition());            
    };

    var fillSlide = function(id, observation){
      //$("#item_" + id ).children("div.carousel-caption").children("h3").text(observation.species_guess);
      obs_userdata = obs_data_slider[observation.id];
      $("#bottom").html(data_slice_to_html(obs_userdata));
      //$("#item_" + id ).children("img").attr("src",observation.observation_photos[0].photo.large_url);
      $("#item_" + id ).children("img").attr("src","/attachments/local_photos/Voltor_tallat_slider.png");
      //http://localhost:4000/attachments/local_photos/Voltor_tallat_slider.png
      /*var capped_desc = "...";
      if(observation.description){
      	capped_desc = observation.description.length > 40 ? observation.description.substring(0, 37) + "..." : observation.description.substring(0, observation.description.length);
      }
      $("#item_" + id ).children("div.carousel-caption").children("p").text(capped_desc);
      $("#item_" + id ).children("div.carousel-caption").children("a").attr("href","/observations/" + observation.id);
      var formatted_sp_guess = observation.species_guess || "Algo...";
      $("#item_" + id ).children("div.carousel-caption").children("a").text(formatted_sp_guess);*/
    }

    var truncate = function(str,n){
      return (str.length > n) ? str.substr(0,n-1)+'&hellip;' : this;
    };

    var getInfoWindow = function() {
  		if (!infoWindow) {
    		infoWindow = new google.maps.InfoWindow({
       	content: $('<div class="loading status">Loading...</div>').get(0),
       	position: new google.maps.LatLng(0,0)
    	})
  	}
  		return infoWindow;
		}

    var setLocaleCookie = function(locale_string) {
      document.cookie = "locale=" + locale_string;
    }
<commit_msg>Removed test picture from slider<commit_after><html>
<head>	
	<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">	
	<%= stylesheet_link_tag 'new_welcome' %> 
	<link href='https://fonts.googleapis.com/css?family=PT+Sans' rel='stylesheet' type='text/css'>
	<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
	<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<!-- Google maps include -->
  <script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCCeenRdnkY-eXliSSYWMykY8-AzO_z5aM" type="text/javascript"></script>
	<%= javascript_include_tag 'isotope.pkgd.min' %>
	<%= javascript_include_tag 'wax.g' %>
  <%= javascript_include_tag "i18n" %>
  <%= javascript_include_tag "translations" %>
<script>
	function toggleHeaderSubnav(link) {
	  if ($(link).parents('.subnavtab').hasClass('open')) {
	    closeHeaderSubnav(link);
	  } else {
	    openHeaderSubnav(link);
	  }
	}

	function openHeaderSubnav(link) {
	  $('.subnav').hide();
	  $('.subnavtab').removeClass('open');
	  $(link).parents('.subnavtab').addClass('open');
	  $(link).parents('li').find('.subnav').show();
	  $(document).click(subnavClickOff);
	}

	function closeHeaderSubnav(link) {
	  $(link).parents('.subnavtab').removeClass('open');
	  $(link).parents('li').find('.subnav').hide();
	  $(document).unbind('click', subnavClickOff);
	}

	function subnavClickOff(e) {
	  if ($(e.target).parents('.subnavwrapper').length == 0) {
	    $('.subnav').hide();
	    $('.subnavtab').removeClass('open');
	  }
	}
</script>
<script>
	$(document).ready(function(){
    window.observations = <%=json_escape @observations.to_json( :include => { :observation_photos => { :include => { :photo => { :except => :metadata } } } }).html_safe %>;

    var infoWindow;

    var map = new google.maps.Map(document.getElementById('map'), {
      center: {lat: -34.397, lng: 150.644},
      zoom: 9,
      maxZoom: 13,
      minZoom: 9
    });
    
    var features = [];
    if(observations){
      for(var i = 0; i < observations.length; i++){
        var obs_n = observations[i];
        var marker = new google.maps.Marker({
          position: {lat: parseFloat(obs_n.latitude), lng: parseFloat(obs_n.longitude)},
          icon: "<%= image_url("mapMarkers/natusfera-marker-mini.png") %>"
        });
        features.push({ marker: marker, observation: obs_n  });
      } 
    }

    var tile_server_url = <%= CONFIG.tile_servers.windshaft.inspect.html_safe %>;
    //var tile_server_url = "http://192.168.127.12:4000";

	  var tilejson = {
			tiles : [tile_server_url + "/observations/points/{z}/{x}/{y}.png?"],
			grids: [tile_server_url + "/observations/points/{z}/{x}/{y}.grid.json?&interactivity=id,taxon_id,species_guess,latitude,longitude,positional_accuracy,captive,quality_grade,iconic_taxon_id"],
			template : "{{species_guess}}",
			interactivity : "id,taxon_id,species_guess,latitude,longitude,positional_accuracy,captive,quality_grade,iconic_taxon_id"	
		};

		var interactionlayer = new wax.g.connector( tilejson );

		map.overlayMapTypes.push(interactionlayer);

    wax.g.interaction().map(map).tilejson(tilejson)
    .on({
      on: function(o) {
        document.body.style.cursor = 'pointer'
        if (o.e.type == 'click') {
          // if the click is anywhere within the InfoWindow, don't act on it
          if($('.gm-style-iw').parent().find(o.e.target).length > 0) { return false; }
          if(o.data['latitude']){
            var latLng = new google.maps.LatLng(o.data['latitude'],o.data['longitude']);
            $.ajax({
              url:  '/observations/' + o.data['id'] + '.html?partial=cached_component',              
              //url:  '/observations/132.html?partial=cached_component',
              type: 'GET',
              dataType: 'html',
              beforeSend: function() {
                var iw = getInfoWindow();
                iw.position = latLng;                
                iw.setContent($('<div class="loading status">Loading...</div>').get(0));
                iw.open(map);                
              },
              success: function(data) {
                var iw = getInfoWindow()
                iw.position = latLng;                
                iw.setContent($('<div class="compact mini infowindow observations"></div>').append(data).get(0));
                iw.open(map);
                // make sure the InfoWindow has focus
                $(iw).focus();                
              },
              error: function(jqXHR, textStatus, errorThrown) {
                console.log(textStatus);
              }
            });
          }
        } else if (o.e.type == 'mousemove') {
          map.setOptions({ draggableCursor: 'pointer' });
        }
      },
      off: function(o) {
        map.setOptions({ draggableCursor: 'url(http://maps.google.com/mapfiles/openhand.cur), move' });
      }
    });
    var data_slice_to_html = function(data_slice){
      var retVal = "<a class=\"username_label\" href=\"" + data_slice.url + "\">" + data_slice.name + "</a> - <a class=\"species_label\" href=\"" + data_slice.especie_url + "\">" + data_slice.especie + "</a>";
      if(data_slice.place_guess_url){
        retVal = retVal + ", " + data_slice.place_guess_url;
      }
      return retVal;
    }

    var activate_locale_link = function(locale){
      var control = $("#locale_" + locale);
      if(control){
        $(".locale_link").removeClass("active");
        control.addClass("active");
      }
    }

    var init_locale = '<%= I18n.locale %>';

    if(init_locale && init_locale != ''){
      activate_locale_link(init_locale);
    }

    obs_data_slider = [];
    <% for observation in @observations %>
      var obs_<%= observation.id %> = {};
      <% if observation.user.name and observation.user.name != ''%>
      obs_<%= observation.id %>.name = '<%= observation.user.name.html_safe %>';
      <% else %>
      obs_<%= observation.id %>.name = '<%= observation.user.login.html_safe %>';
      <% end %>
      obs_<%= observation.id %>.url = '<%= observations_by_login_url(observation.user.login) %>';
      <% unless observation.species_guess.blank? %>
        obs_<%= observation.id %>.especie = '<%= observation.species_guess.html_safe %>';
      <% else %>
        obs_<%= observation.id %>.especie = '<%=t :something %>';
      <% end %>
      obs_<%= observation.id %>.especie_url = '<%= observation_path(observation) %>';
      obs_data_slider[<%= observation.id %>] = obs_<%= observation.id %>;

      obs_<%= observation.id %>.place_guess_url = '<%= observation_place_guess(observation).html_safe %>';
    <% end %>
    var getItemId = function(id){
      return parseInt(id.substring(id.indexOf("_")+1));
    };

    var clearMarkers = function(){
      for(var i = 0; i < features.length; i++){
        features[i].marker.setMap(null);
      }
    };
    var setCurrentMarker = function(marker){
      clearMarkers();
      marker.setMap(map);
      map.panTo(marker.getPosition());            
    };

    var fillSlide = function(id, observation){
      //$("#item_" + id ).children("div.carousel-caption").children("h3").text(observation.species_guess);
      obs_userdata = obs_data_slider[observation.id];
      $("#bottom").html(data_slice_to_html(obs_userdata));
      $("#item_" + id ).children("img").attr("src",observation.observation_photos[0].photo.large_url);
      //$("#item_" + id ).children("img").attr("src","/attachments/local_photos/Voltor_tallat_slider.png");
      //http://localhost:4000/attachments/local_photos/Voltor_tallat_slider.png
      /*var capped_desc = "...";
      if(observation.description){
      	capped_desc = observation.description.length > 40 ? observation.description.substring(0, 37) + "..." : observation.description.substring(0, observation.description.length);
      }
      $("#item_" + id ).children("div.carousel-caption").children("p").text(capped_desc);
      $("#item_" + id ).children("div.carousel-caption").children("a").attr("href","/observations/" + observation.id);
      var formatted_sp_guess = observation.species_guess || "Algo...";
      $("#item_" + id ).children("div.carousel-caption").children("a").text(formatted_sp_guess);*/
    }

    var truncate = function(str,n){
      return (str.length > n) ? str.substr(0,n-1)+'&hellip;' : this;
    };

    var getInfoWindow = function() {
  		if (!infoWindow) {
    		infoWindow = new google.maps.InfoWindow({
       	content: $('<div class="loading status">Loading...</div>').get(0),
       	position: new google.maps.LatLng(0,0)
    	})
  	}
  		return infoWindow;
		}

    var setLocaleCookie = function(locale_string) {
      document.cookie = "locale=" + locale_string;
    }

{'fraction_non_alphanumeric': 0.18267752405899437, 'fraction_numerical': 0.008313877341837025, 'mean_word_length': 2.8811049723756907, 'pattern_counts': {'":': 0, '<': 123, '<?xml version=': 0, '>': 135, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2535774', 'n_tokens_mistral': 5969, 'n_tokens_neox': 5601, 'n_words': 830}