diff --git a/layers/chains/culvers/layer.js b/layers/chains/culvers/layer.js index 8ee7e58..af140b4 100644 --- a/layers/chains/culvers/layer.js +++ b/layers/chains/culvers/layer.js @@ -2,8 +2,6 @@ import VectorLayer from 'ol/layer/Vector'; import {Vector as VectorSource} from 'ol/source.js'; import GeoJSON from 'ol/format/GeoJSON.js'; -import { toLonLat } from 'ol/proj'; - import {Style} from 'ol/style.js'; import Icon from 'ol/style/Icon.js'; @@ -23,23 +21,4 @@ const vectorLayer = new VectorLayer({ }), }); -vectorLayer.customPopupCallback = async function(feature) { - const fotd_parent = document.createElement('div'); - fotd_parent.innerHTML = "Flavor of the Day: "; - document.querySelector('#popup-content').append(fotd_parent); - - const fotd_child = document.createElement('span'); - fotd_child.innerHTML = "Loading…"; - - const fotd_image = document.createElement('img') - fotd_parent.append(fotd_child, fotd_image); - - const [long, lat] = toLonLat(feature.getGeometry().getCoordinates()); - const res = await fetch(`https://corsproxy.io/?${encodeURIComponent(`https://www.culvers.com/api/restaurants/getLocations?lat=${lat}&long=${long}&limit=1`)}`) - const res_data = await res.json(); - fotd_child.innerHTML = res_data.data.geofences[0].metadata.flavorOfDayName; - fotd_image.src = `https://cdn.culvers.com/menu-item-detail/${res_data.data.geofences[0].metadata.flavorOfDaySlug}`; - fotd_image.style.width = "min(300px, 60vh)"; -} - export default vectorLayer; diff --git a/layers/chains/index.js b/layers/chains/index.js index bd89355..6ad85f2 100644 --- a/layers/chains/index.js +++ b/layers/chains/index.js @@ -5,7 +5,6 @@ import kwikTripLayer from './kwik-trip/layer.js'; import menardsLayer from './menards/layer.js'; import milwaukeeBurgerCompanyLayer from './milwaukee-burger-company/layer.js'; import punchPizzaLayer from './punch-pizza/layer.js'; -import raisingCanesLayer from './raising-canes/layer.js'; import waffleHouseLayer from './waffle-house/layer.js'; import whataburgerLayer from './whataburger/layer.js'; @@ -40,10 +39,6 @@ const chains = { name: "Punch Pizza", layer: punchPizzaLayer, }, - { - name: "Raising Cane's", - layer: raisingCanesLayer, - }, { name: "Waffle House", layer: waffleHouseLayer, diff --git a/layers/chains/raising-canes/get_data.py b/layers/chains/raising-canes/get_data.py deleted file mode 100755 index dc6e4f6..0000000 --- a/layers/chains/raising-canes/get_data.py +++ /dev/null @@ -1,46 +0,0 @@ -#!/usr/bin/env python3 - -import requests -import json - -print("Searching for Raising Cane's locations") -response = requests.get('https://raisingcanes.com/page-data/sq/d/3976656178.json').json() - -stores = [] - -for s in response['data']['allPrismicStoreLocation']['nodes']: - if s['uid'] == 'ara2': # Not sure what's up with this one: https://raisingcanes.com/locations/ara2/ - continue - elif s['uid'] == 'c524': # Null island? https://raisingcanes.com/locations/c524/ - s['data']['coordinates'] = { - "longitude": -111.9811399, - "latitude": 40.5447361, - } - stores.append({ - "type": "Feature", - "geometry": { - "type": "Point", - "coordinates": [float(s['data']['coordinates']['longitude']), float(s['data']['coordinates']['latitude'])], # yes, [lon, lat] since it's [x, y] - }, - "properties": { - 'name': s['data']['external_location_data']['displayName'], - 'nickname': s['data']['external_location_data']['nickname'], - 'address': s['data']['external_location_data']['address1'], - 'city': s['data']['external_location_data']['city'], - 'state': s['data']['external_location_data']['state'], - 'zip': s['data']['external_location_data']['postal_code'], - 'website': f"https://raisingcanes.com/locations/{s['uid']}", - 'opened': s['data']['external_location_data']['birthdate'], - 'hours': s['data']['external_location_data']['hours'], - }, - }) - -print(f"""{len(stores)} locations found""") - -geojson = { - "type": "FeatureCollection", - "features": stores, -} - -with open("data.geojson", "w") as f: - f.write(json.dumps(geojson)) diff --git a/layers/chains/raising-canes/layer.js b/layers/chains/raising-canes/layer.js deleted file mode 100644 index af140b4..0000000 --- a/layers/chains/raising-canes/layer.js +++ /dev/null @@ -1,24 +0,0 @@ -import VectorLayer from 'ol/layer/Vector'; -import {Vector as VectorSource} from 'ol/source.js'; -import GeoJSON from 'ol/format/GeoJSON.js'; - -import {Style} from 'ol/style.js'; -import Icon from 'ol/style/Icon.js'; - -import url from './data.geojson?url'; // TODO: remove `?url`? -import pin from './pin.svg?url'; // TODO: remove `?url`? - -const vectorLayer = new VectorLayer({ - source: new VectorSource({ - url: url, - format: new GeoJSON, - }), - style: new Style({ - image: new Icon({ - anchor: [0.5, 1], - src: pin, - }), - }), -}); - -export default vectorLayer; diff --git a/layers/chains/raising-canes/pin.svg b/layers/chains/raising-canes/pin.svg deleted file mode 100644 index 344a169..0000000 --- a/layers/chains/raising-canes/pin.svg +++ /dev/null @@ -1,278 +0,0 @@ - - diff --git a/main.js b/main.js index 652a83e..6aaadc2 100644 --- a/main.js +++ b/main.js @@ -119,14 +119,8 @@ for (let category of layerCategories) { document.querySelector("aside").appendChild(catDiv); } -const urlParams = new URLSearchParams(window.location.search); -const urlLayers = urlParams.getAll('layer'); - for (let category of layerCategories) { for (let layer of category.layers) { - if (urlLayers.includes(layer.name)) { - layer.enabled = true; - } if (layer.enabled) { map.addLayer(layer.layer); } @@ -140,7 +134,7 @@ function objectToTable(o) { if (typeof value === "object") { value = objectToTable(value); } - if (typeof value === "string" && /^https?:\/\//.test(value)) { + if (typeof value === "string" && value.startsWith('https://')) { value = `${value}` } table += `