Skip to content

Display recent stolen bikes on your webpage!

Notifications You must be signed in to change notification settings

bikeindex/stolen_bikes_widget_html

Repository files navigation

Recent stolen bikes & search widget

Alert people to recent thefts! Add a convenient way to search for stolen bikes right on your page.

Example widget display

All you need to do is include this HTML snippet where you would like the widget to appear:

<div id="binx-stolen-widget"></div>

And add this to the header of your page:

<script src="https://widget.bikeindex.org/stolen-widget.js"></script>

Extra options

A few options for customization and configuration:

property what it does default
location Find stolen bikes near this location first (address, city, state or lat/long) Shows recent for
height max-height for the widget in pixels 400px
recentResults Boolean - whether or not it should fetch recent stolen bikes (it starts just as a search widget) true
cacheResults Store recent results for three hours in localstorage true
elementId the id of the div element for the widget binx-stolen-widget

Examples

Set the options when configuring the widget within the script tag:

<!-- Override default options -->

<script>
  BikeIndexWidget.init({
    height: 400,
    cacheResults: true,
    recentResults: true,
    location: 'Portland, OR',
    elementId: 'some-other-id',
  });
</script>
<!-- No options -->

<script>
  BikeIndexWidget.init();
</script>

Running locally

  1. Install dependencies
yarn
  1. Start webpack server in development mode
yarn start
  • This should open the widget in your browser here

Testing

  1. Run the script to lint and run the jest specs:
yarn test

// OR

yarn watch

Made with all the 🍩s. Bike Index