<commit_before>const SparqlClient = require('sparql-client')
const $ = require('jquery')

// <-------------- Variables ---------------->
var endpoint = 'http://dbpedia.org/sparql'
var client = new SparqlClient(endpoint)
var sights = []
var lat, long


// <------------- onload ----------------------->
$(document).ready(function(){

  // sets the lat and lng of the current user
  getLocation()
})


// eventhandler for input field
  $( 'form' ).submit(function( event ) {
    var city = $('#inputfield').val()
    $('#cityname').html(city)
    $('#inputfield').val('')
    $('#cityerror').html('')
    getSightsByCity(city)
    event.preventDefault()
  })


// view results
  function showResults(object) {
    var arr = object.results.bindings
    $('#sightlist').html("")

    if(arr.length == 0) {
      $('#cityerror').html("no sights found")
    }
    else {
      for (var i = 0; i < arr.length; i++) {
        var val = arr[i].Label.value
        $('#sightlist').append('<li onclick="showInfos();">' + val + '</li>')
      }
    }
  }

// view infos per sight
  function showInfos() {
    console.log("funkt!")
  }



  // <------------ User Location --------------->
  function getLocation() {
    if (navigator.geolocation) {
        return navigator.geolocation.getCurrentPosition(setCoords);
    } else {
      console.log("Geolocation is not supported by this browser.")
    }
  }


  function setCoords(position) {
    lat = position.coords.latitude
    long = position.coords.longitude

    // centers the map at the current position of the user
    map.setCenter({lat: lat, lng: long})
  }


  function setMarkers() {

  }



  // runs a query against the DB with given params
  function queryDB(query) {
    client.query(query, function (error, results) {
      if (error) {
        console.log(error)
      } else {
        console.log(results.results.bindings)
        sights = results.results.bindings
        // showResults(results)
      }
    })
  }


  function getSightsInProximity() {
    var query = ""


    queryDB(query)<commit_msg>tried to lay click method handle on li<commit_after>const SparqlClient = require('sparql-client')
const $ = require('jquery')

// <-------------- Variables ---------------->
var endpoint = 'http://dbpedia.org/sparql'
var client = new SparqlClient(endpoint)
var sights = []
var lat, long


// <------------- onload ----------------------->
$(document).ready(function(){

  // sets the lat and lng of the current user
  getLocation()
})


// eventhandler for input field
  $( 'form' ).submit(function( event ) {
    var city = $('#inputfield').val()
    $('#cityname').html(city)
    $('#inputfield').val('')
    $('#cityerror').html('')
    getSightsByCity(city)
    event.preventDefault()
  })


// view results
  function showResults(object) {
    var arr = object.results.bindings
    $('#sightlist').html("")

    if(arr.length == 0) {
      $('#cityerror').html("no sights found")
    }
    else {
      for (var i = 0; i < arr.length; i++) {
        var val = arr[i].Label.value
        $('#sightlist').append('<li value="' + i + '">' + val + '</li>')
      }
    }
  }

// view infos per sight
  function showInfos() {
    $("ul#sightlist > li").click(function(){
        alert("The li was clicked.")
    })
  }


  // <------------ User Location --------------->
  function getLocation() {
    if (navigator.geolocation) {
        return navigator.geolocation.getCurrentPosition(setCoords);
    } else {
      console.log("Geolocation is not supported by this browser.")
    }
  }


  function setCoords(position) {
    lat = position.coords.latitude
    long = position.coords.longitude

    // centers the map at the current position of the user
    map.setCenter({lat: lat, lng: long})
  }


  function setMarkers() {

  }



  // runs a query against the DB with given params
  function queryDB(query) {
    client.query(query, function (error, results) {
      if (error) {
        console.log(error)
      } else {
        console.log(results.results.bindings)
        sights = results.results.bindings
        showResults(results)
      }
    })
  }


  function getSightsInProximity() {
    var query = ""


    queryDB(query)
{'fraction_non_alphanumeric': 0.18986438258386867, 'fraction_numerical': 0.0009517011658339282, 'mean_word_length': 2.284375, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 14, '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': '3772157', 'n_tokens_mistral': 1314, 'n_tokens_neox': 1261, 'n_words': 304}