publiclab/leaflet-blurred-location

View on GitHub
examples/simple.html

Summary

Maintainability
Test Coverage
<!DOCTYPE html>
<html lang="en">
  <head>

    <title>Leaflet.BlurredLocation</title>

    <script src="https://maps.googleapis.com/maps/api/js?libraries=places&language=en&key=AIzaSyAOLUQngEmJv0_zcG1xkGq-CXIPpLQY8iQ"></script>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
    <link href="../node_modules/leaflet/dist/leaflet.css" rel="stylesheet">
    <script src="../node_modules/jquery/dist/jquery.min.js"></script>
    <script src="../node_modules/bootstrap/dist/js/bootstrap.min.js"></script>
    <script src="../dist/Leaflet.BlurredLocation.js"></script>

  </head>

  <body>

    <!-- START OF EXAMPLE -->
    <div class="container" >
      <div class="row" >
        <div class="col-md-8">
          <label class="h2 font-size-big"><input type="radio" />&nbsp;&nbsp;Add location to your content</label>
          <br/><br/>
          <h4 class="font-size-small">Option 1 : By Placename</h4>
          </br>
          <input id="placenameInput" type="text" class="form-control"><br/>
          <h4 class="font-size-small">Option 2 : By dragging the map</h4></br>
          <h4 class="font-size-small">Option 3 : By giving co-ordinates</h4></br>
          <div class="col-md-6">
            <input id="lat" type="text" class="form-control" placeholder="Latitude"><br/>
          </div>
          <div class="col-md-6">
            <input id="lng" type="text" class="form-control" placeholder="Longitude"><br/>
          </div>
        </div>
        <div class="col-md-4">
          <h3 class="font-size-small">On a map : </h3>
          <br />
          <div id="map" class="leaflet-map" style="width: 400px; height: 400px;"></div>
          <br/>
          <h3 class="font-size-small">In Text:</h3><br/>
          <input id="placenameDisplay" type="text" class="form-control"><br/>
        </div>
      </div>
    </div>
    <!-- END OF EXAMPLE -->
  <script>
    options = {}

  // We can add Interface Options as follows:
    InterfaceOptions = {};
    InterfaceOptions.latId = 'lat';
    InterfaceOptions.lngId = 'lng';

    options.InterfaceOptions = InterfaceOptions;

    var blurredLocation = new BlurredLocation(options);
    blurredLocation.panMapToGeocodedLocation("placenameInput");
    blurredLocation.gridSystem.removeGrid();
    blurredLocation.disableCenterShade();

  </script>
  </body>
</html>