<commit_before><script type="text/javascript">
  $( document ).ready(function() {
  $('#geobutton').on('click', function () {
    geoFindMe();
  })
  });

function geoFindMe() {

  if (!navigator.geolocation){
    alert("Sorry, finding your location is not supported by your browser");
    $('#geobutton').attr("disabled", true)
    return;
  }

  function success(position) {
    var latitude  = position.coords.latitude;
    var longitude = position.coords.longitude;
    var text = longitude + ',' + latitude;
    $("#near").val(text)
  }

  function error() {
    alert("Sorry, we are unable to get your location");
  }

  $("#near").val("Locating…")

  navigator.geolocation.getCurrentPosition(success, error);
}
</script>
<div id="out"></div>
<%= form_tag("/courses", method: "get", class: 'form-horizontal ', role: 'form') do %>
  <div class="form-group ">
    <%= label_tag(:q, "Find", class:"col-sm-1 control-label") %>
    <div class="col-sm-11">
      <%= text_field_tag(:q, params[:q], class:"form-control", placeholder: "Courses, Subjects, Topics") %>
    </div>
  </div>

  <div class="form-group ">
    <%= label_tag(:near, "Near", class:"col-sm-1 control-label") %>
    <div class="col-sm-5">
      <%= text_field_tag(:near, params[:near], class:"form-control near-field", placeholder: "Postcode, Place, Address") %>
      <%= hidden_field_tag(:sort, params[:sort]) %>   
    </div>
    
    <div class="col-sm-3">
      <span class="location-hint">Use current location</span>
      <button id="geobutton" class="geobutton btn btn-default" type="button" title="Use current location"> <%= image_tag 'location.png', width: 25, height: 25 %></button>
    </div>

</div><commit_msg>hide geolocation button if the browser doesnt support it<commit_after><script type="text/javascript">
$( document ).ready(function() {
  if (navigator.geolocation){
    $('.use-location').show();
  }
  
  $('#geobutton').on('click', function () {
    geoFindMe();
  })
  });

function geoFindMe() {

  if (!navigator.geolocation){
    alert("Sorry, finding your location is not supported by your browser");
    $('#geobutton').attr("disabled", true)
    return;
  }

  function success(position) {
    var latitude  = position.coords.latitude;
    var longitude = position.coords.longitude;
    var text = longitude + ',' + latitude;
    $("#near").val(text)
  }

  function error() {
    alert("Sorry, we are unable to get your location");
  }

  $("#near").val("Locating…")

  navigator.geolocation.getCurrentPosition(success, error);
}
</script>
<div id="out"></div>
<%= form_tag("/courses", method: "get", class: 'form-horizontal ', role: 'form') do %>
  <div class="form-group ">
    <%= label_tag(:q, "Find", class:"col-sm-1 control-label") %>
    <div class="col-sm-11">
      <%= text_field_tag(:q, params[:q], class:"form-control", placeholder: "Courses, Subjects, Topics") %>
    </div>
  </div>

  <div class="form-group ">
    <%= label_tag(:near, "Near", class:"col-sm-1 control-label") %>
    <div class="col-sm-5">
      <%= text_field_tag(:near, params[:near], class:"form-control near-field", placeholder: "Postcode, Place, Address") %>
      <%= hidden_field_tag(:sort, params[:sort]) %>   
    </div>
    
    <div class="col-sm-3 use-location" style="display:none;">
      <span class="location-hint">Use current location</span>
      <button id="geobutton" class="geobutton btn btn-default" type="button" title="Use current location"> <%= image_tag 'location.png', width: 25, height: 25 %></button>
    </div>

</div>
{'fraction_non_alphanumeric': 0.19875424688561721, 'fraction_numerical': 0.0056625141562853904, 'mean_word_length': 3.9274755927475593, 'pattern_counts': {'":': 0, '<': 53, '<?xml version=': 0, '>': 53, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, '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': '916001', 'n_tokens_mistral': 1218, 'n_tokens_neox': 1145, 'n_words': 254}