Git Product home page Git Product logo

storelocatorjs / storelocator Goto Github PK

View Code? Open in Web Editor NEW
11.0 3.0 9.0 3.66 MB

๐Ÿ—บ๏ธ Storelocatorjs is a fast and lightweight Javascript library for build your own customizable store locator with a minimalist theme. The cloud function is included to handle store filter requests.

Home Page: https://storelocator.js.org

JavaScript 84.03% CSS 15.97%
javascript google-maps google-maps-api storelocator markers clusters geolocation infowindow filters responsive-design

storelocator's Introduction

Storelocatorjs

GitHub Workflow Status (branch) jsDelivr

Storelocatorjs is a fast and lightweight Javascript library to easily build a store locator using Google Maps API V3. Only 6Kb on production with gzip, Storelocatorjs has no dependency with any framework or library and is written in Javascript native.

Storelocatorjs on desktop

Examples

The project includes several examples of storelocatorjs implementation in the directory examples. Run the following commands to build the assets for the examples:

npm run build && npm run build:example

Installation

The library is available as the storelocatorjs package name on npm.

npm install storelocatorjs --save-dev
yarn add storelocatorjs --dev

Demo

Online demo is available on https://storelocatorjs.github.io/demo.

How it works

Cloud functions

All requests to filter stores by geoposition are send to a cloud function as a web service. Storelocatorjs includes the cloud functions project from Google Firebase located in the ./functions folder.

Structure

The extended usage of the Storelocatorjs with filters and store categories used a minimalist HTML structure.

<div class="storelocator">
  <div class="storelocator-loader"></div>
  <div class="storelocator-sidebar">
    <form class="storelocator-formSearch" name="form-search">
      <input
        type="text"
        class="storelocator-inputSearch"
        placeholder="Enter a location"
        autocomplete="off"
      />
      <div class="storelocator-formFilters">
        <div class="storelocator-formFiltersRow">
          <div class="storelocator-formCheckbox">
            <input type="checkbox" id="cat-1" data-filter checked="checked" value="1" />
            <label for="cat-1" class="category-1">Categorie 1</label>
          </div>
          <div class="storelocator-formCheckbox">
            <input type="checkbox" id="cat-2" data-filter checked="checked" value="2" />
            <label for="cat-2" class="category-2">Categorie 2</label>
          </div>
        </div>
        <div class="storelocator-formFiltersRow">
          <div class="storelocator-formCheckbox">
            <input type="checkbox" id="cat-3" data-filter value="3" />
            <label for="cat-3" class="category-3">Categorie 3</label>
          </div>
        </div>
      </div>
    </form>
    <nav class="storelocator-nav">
      <ul class="storelocator-navList">
        <li class="storelocator-navListItem active">
          <button class="storelocator-navButton" data-switch-view data-target="map">Map</button>
        </li>
        <li class="storelocator-navListItem">
          <button class="storelocator-navButton" data-switch-view data-target="list">List</button>
        </li>
      </ul>
    </nav>
    <div class="storelocator-sidebarResults"></div>
  </div>
  <div class="storelocator-googleMaps active">
    <div id="storelocator-googleMapsCanvas"></div>
    <button class="storelocator-geolocButton"></button>
  </div>
</div>

Options

Storelocatorjs contains many options to allow you to easily configure your map according to your needs. Options are available on the Storelocatorjs website.

Example with the onReady function

The onReady function expose the Google Maps instance as map variable and is called when the map is instantiated and ready. With the example below, an automatic search is triggered with location coordinates passed in parameters.

new Storelocator({
    apiKey: '',
    webServiceUrl: ''
}, onReady: function(map) {
    this.triggerRequest({
        'lat': 48.8589507,
        'lng': 2.2770202
    });
})

Browsers support

The project is fully compatible with the most popular web browsers. More information about the Google Maps support on Google Developers. HTML and CSS files are W3C valid.

Licenses

Commercial license

If you want to use Storelocatorjs to develop commercial sites, themes, projects, and applications, the Commercial License is the appropriate license. With this option, your source code is kept proprietary. Purchase a Storelocatorjs Commercial License on the license page.

Open source license

If you are creating an open source application under a license compatible with the GNU GPL license v3, you may use Storelocatorjs under the terms of the GPLv3.

Contributors

Created with โ™ฅ by @yoriiis

storelocator's People

Contributors

dependabot-preview[bot] avatar dependabot[bot] avatar yoriiis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

storelocator's Issues

Can't zoom out using Google Maps buttons

Description

When I try to zoom out using Google Maps buttons I can't do it. Only zoom in works.
Zoom using keyboard buttons "-" and "+" works ok.

Steps to reproduce

  1. Open demo app https://yoriiis.github.io/storelocatorjs/demo.html
  2. Try to zoom out using Google Maps buttons

Results

Expected

Should zoom out.

Actual

Button doesn't click, zoom out doesn't work.

Error output

No errors in browser console except one with billing.

Additional information

Video https://streamable.com/6innaa

versions

storelocatorjs

Demo version so probably newest 1.8.3

Browsers

Tested on:

Ubuntu:

  • Brave Version 1.2.43 Chromium: 79.0.3945.130 (Official Build) (64-bit)
  • Firefox 74.0 (64-bit)
  • Chromium Version 80.0.3987.163 (Official Build) snap (64-bit)

Android:

  • Chrome 78.0.3904.62

OS

Ubuntu 18.04.4 LTS
Android 9

Valid regions for Firebase function?

I've been testing this locally and with deployment to Firebase, but I can't for the life of me find the list of valid regions and how they're configured in order to customize.

The demo versions are set to 'europe-west1' and when I change this value in the functions index.js, I get the printout in the console of valid regions, but that's only place I've been able to find it.

Is there a way to customize this? And what does this affect when changed?

Error: The only valid regions are: us-central1, us-east1, us-east4, europe-west1, europe-west2, asia-east2, asia-northeast1
    at assertRegionsAreValid (/functions/node_modules/firebase-functions/lib/function-builder.js:62:15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.