<commit_before>(function ($, L) {
  function screenSize () {
    return $(window).width() > 400 ? 'large' : 'small'
  }

  var map = new L.Map('map')

  function userLocator (map, s) {
    var settings = s || {
      setView: true,
      maxZoom: 17
    }
    var component = {}
    var button
    var circle

    function onLocationFound (e) {
      console.log(e)
      if (circle === undefined) {
        circle = L.circle(e.latlng, 200).addTo(map)
      } else {
        circle.setLatLng(e.latlng).setRadius(200)
      }
    }

    function onLocationError (e) {
      console.log(e)
    }

    map.on('locationfound', onLocationFound)
    map.on('locationerror', onLocationError)
    map.on('stopfollowing', function (e) {
      if (circle !== undefined) {
        circle.setRadius(0)
      }
    })

    component.button = function () {
      if (arguments.length === 1) {
        button = arguments[0]
        return component
      }
      if (button === undefined) {
        button = L.control.locate({
          icon: 'fa fa-map-marker',
          iconLoading: 'fa fa-spinner fa-spin',
          drawCircle: false,
          follow: true,
          onLocationError: onLocationError,
          locateOptions: settings
        })
      }
      return button
    }

    component.start = function () {
      component.button().start()
    }

    component.stop = function () {
      component.button().stop()
    }

    component.mapButton = function () {
      return function () {
        var map = this
        component.button().addTo(map)
      }
    }

    return component
  }
  var locator = userLocator(map)

  function aboutModal (locator, s) {
    var settings = s || {}
    var component = {}

    var $overlay = $('<div id="overlay"></div>')
    var $modal = $('#modal')
    var $content = $('#content')
    var $close = $('<a id="close" href="#">close</a>')
    var $showNextTime = $('<label id="showNextTime"><input type="checkbox"></input>下次顯示這個訊息</label>')
    var $locator = $('<a id="locator" href="#">顯示我的位置</a>')

    $modal.hide()
    $overlay.hide()
    $modal.append($content, $close, $locator, $showNextTime)

    component.mount = function () {
      $('body').append($overlay, $modal)
    }

    component.center = function () {
      var top, left
      top = Math.max($(window).height() - $modal.outerHeight(), 0) / 2
      left = Math.max($(window).width() - $modal.outerWidth(), 0) / 2
      $modal.css({
        top: top + $(window).scrollTop(),
        left: left + $(window).scrollLeft()
      })
    }

    component.open = function () {
      $('.leaflet-control').css('display', 'none')
      $modal.css({
        width: settings.width || 'auto',
        height: settings.height || 'auto'
      })
      component.center()
      $(window).bind('resize.modal', component.center)
      $modal.show()
      $overlay.show()
    }

    component.close = function () {
      $('.leaflet-control').css('display', 'inherit')
      $modal.hide()
      $overlay.hide()
      $(window).unbind('resize.modal')
    }

    $close.click(function (e) {
      e.preventDefault()
      component.close()
    })

    $locator.click(function (e) {
      e.preventDefault()
      locator.start()
      component.close()
    })

    $showNextTime.click(function (e) {
      window.localStorage.showNextTime = $(this).children()[0].checked
    })

    component.showNextTime = function () {<commit_msg>fix UX<commit_after>(function ($, L) {
  function screenSize () {
    return $(window).width() > 400 ? 'large' : 'small'
  }

  var map = new L.Map('map')

  function userLocator (map, s) {
    var settings = s || {
      setView: true,
      maxZoom: 17
    }
    var component = {}
    var button
    var circle

    function onLocationFound (e) {
      console.log(e)
      if (circle === undefined) {
        circle = L.circle(e.latlng, 200).addTo(map)
      } else {
        circle.setLatLng(e.latlng).setRadius(200)
      }
    }

    function onLocationError (e) {
      console.log(e)
    }

    map.on('locationfound', onLocationFound)
    map.on('locationerror', onLocationError)
    map.on('stopfollowing', function (e) {
      if (circle !== undefined) {
        circle.setRadius(0)
      }
    })

    component.button = function () {
      if (arguments.length === 1) {
        button = arguments[0]
        return component
      }
      if (button === undefined) {
        button = L.control.locate({
          icon: 'fa fa-map-marker',
          iconLoading: 'fa fa-spinner fa-spin',
          drawCircle: false,
          follow: true,
          onLocationError: onLocationError,
          locateOptions: settings
        })
      }
      return button
    }

    component.start = function () {
      component.button().start()
    }

    component.stop = function () {
      component.button().stop()
    }

    component.mapButton = function () {
      return function () {
        var map = this
        component.button().addTo(map)
      }
    }

    return component
  }
  var locator = userLocator(map)

  function aboutModal (locator, s) {
    var settings = s || {}
    var component = {}

    var $overlay = $('<div id="overlay"></div>')
    var $modal = $('#modal')
    var $content = $('#content')
    var $close = $('<a id="close" href="#">close</a>')
    var $showNextTime = $('<label id="showNextTime"><input type="checkbox"></input>下次顯示這個訊息</label>')
    var $locator = $('<a id="locator" href="#">顯示我的位置</a>')

    $modal.hide()
    $overlay.hide()
    $modal.append($content, $close, $locator, $showNextTime)

    component.mount = function () {
      $('body').append($overlay, $modal)
    }

    component.center = function () {
      var top, left
      top = Math.max($(window).height() - $modal.outerHeight(), 0) / 2
      left = Math.max($(window).width() - $modal.outerWidth(), 0) / 2
      $modal.css({
        top: top + $(window).scrollTop(),
        left: left + $(window).scrollLeft()
      })
    }

    component.open = function () {
      $('.leaflet-control').css('display', 'none')
      $modal.css({
        width: settings.width || 'auto',
        height: settings.height || 'auto'
      })
      component.center()
      $(window).bind('resize.modal', component.center)
      $modal.show()
      $overlay.show()
    }

    component.close = function () {
      $('.leaflet-control').css('display', 'inherit')
      $modal.hide()
      $overlay.hide()
      $(window).unbind('resize.modal')
    }

    $overlay.click(function (e) {
      e.preventDefault()
      component.close()
    })

    $close.click(function (e) {
      e.preventDefault()
      component.close()
    })

    $locator.click(function (e) {
      e.preventDefault()
      locator.start()
      component.close()
    })

    $showNextTime.click(function (e) {
      window.localStorage.showNextTime = $(this).children()[0].checked
    })

    component.showNextTime = function () {
{'fraction_non_alphanumeric': 0.1673881673881674, 'fraction_numerical': 0.005483405483405483, 'mean_word_length': 2.2448501872659175, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 25, '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': '7256481', 'n_tokens_mistral': 2213, 'n_tokens_neox': 2148, 'n_words': 427}