diff --git a/csv/Chapters.csv b/csv/Chapters.csv
deleted file mode 100644
index 899a4fd9..00000000
--- a/csv/Chapters.csv
+++ /dev/null
@@ -1,12 +0,0 @@
-Chapter,Media Link,Media Credit,Media Credit Link,Description,Zoom,Marker,Marker Color,Location,Latitude,Longitude,Found,Quality,Source,Overlay,Overlay Transparency,GeoJSON Overlay,GeoJSON Feature Properties
-Hartford Public High School 1847,media/1847-HPHS-Catalog1904p164.jpg,Source: HPHS Quadrennial Catalogue 1904,https://www.flickr.com/photos/56513965@N06/21047067205,This scroll-driven story map is built using open-source Leaflet code and a linked Google Sheet for data. The interactive design is ideal for telling a story that brings users to different locations on a map. Or users can click on any marker to go directly to that chapter.,,Numbered,blue,,41.7676,-72.6782,,,,,,,
-Hartford Public High School 1905,media/1905-HPHS-postcard.jpg,Source: 1905 postcard,https://flic.kr/p/2gfEpFk,"In the linked Google Sheet, Insert your point locations, zoom levels, narrative text, and map options (such as title, basemap style, and other settings). Click on the ""View data"" link at the bottom of this map to view the linked Google Sheet.",17,,blue,,41.7677,-72.6848,,,,,,,
-Hartford Public High School 2011,https://live.staticflickr.com/65535/48079851361_bc1cbe30cd_o.jpg,Source: Carlos Velasquez/Flickr,https://flic.kr/p/2gfDNJv,"Images can be uploaded a local subfolder, or pulled from an external URL (such as this photo on a Flickr server). The code automatically resizes images to fit the story map template, and you can modify the width and other settings in the Google Sheet Options tab.",17,,blue,"55 Forest St, Hartford CT",41.7643207,-72.7013414,"55 Forest St, Hartford, CT 06105, USA",Match,Google,https://mapwarper.net/maps/tile/14781/{z}/{x}/{y}.png,0.7,,
-Jackie McLean & The Artists Collective,media/mclean.mp3,Source: iTunes,,"Along with images, Storymaps supports audio files and
-YouTube videos. Audio files must be mp3 (recommended),
-ogg, or wav: the map will generate an <audio> tag fo
- them instead of <img>.",17,,blue,"1200 Albany Ave, Hartford CT",41.782032,-72.69578,"1200 ALBANY AVE, HARTFORD, CT, 06112",Match,US Census,,,geojson/1970.geojson,color:red;weight:2
-"Bradley Airport , Windsor Locks",media/BradleyAirport.jpg,Source: Public domain/Wikimedia,https://commons.wikimedia.org/wiki/File:Airport_2.jpg#/media/File:Airport_2.jpg,"The Leafet 1.x code includes a 'fly to' feature that animates traveling from one map point to the next, which is ideal for transporting users across long distances.",14,,blue,"Bradley Airport,
-Schoephoester Rd, Windsor Locks, CT 06096",41.9388735,-72.6860314,"Bradley International Airport (BDL), Schoephoester Rd, Windsor Locks, CT 06096, USA",Match,Google,,,,
-"Trinity College, Hartford",https://www.youtube.com/embed/CZmu6YWtI58?controls=0,Source: YouTube,https://www.youtube.com/watch?v=CZmu6YWtI58,"Create your own story map using the step-by-step tutorial in Data Visualization For All, an open-access textbook created at Trinity College, Hartford CT. ",12,Plain,blue,"300 Summit St, Hartford CT",41.7473639,-72.6907806,"300 Summit St, Hartford, CT 06106, USA",Match,Google,,,geojson/hartford-post-1897.geojson,color:red;weight:3
-Final chapter,,,,Describe how to add GeoJSON outlines and modify display,12,Hidden,blue,"300 Summit St, Hartford CT",41.7473639,-72.6907806,"300 Summit St, Hartford, CT 06106, USA",Match,Google,,,geojson/hartford-post-1897.geojson,"weight:5; fillColor:rgba(0,0,0,0.5)"
\ No newline at end of file
diff --git a/csv/Options.csv b/csv/Options.csv
deleted file mode 100644
index 5fe2b3b0..00000000
--- a/csv/Options.csv
+++ /dev/null
@@ -1,19 +0,0 @@
-Setting,Customize,Hints,Examples
-Storymap Info,,,
-Storymap Title,My Story Map from CSV,,
-Storymap Subtitle,Add subtitle here,,
-Storymap Logo,media/trinity-college-logo.png,Path to a logo image,
-Map Settings,,,
-Basemap Tiles,CartoDB.Positron,Drop-down menu for background basemap tiles,https://leaflet-extras.github.io/leaflet-providers/preview/
-Zoom Controls,bottomright,,
-Narrative Background Color,,,
-Narrative Text Color,,,
-Narrative Link Color,,,
-Active Chapter Background Color,,,
-Media Container Height,300,"Maximum height of the image, in pixels. 200 is default. The image will be fit into the container with its proportions kept (it won't be skewed).",
-Pixels After Final Chapter,600,In pixels. At least 100,
-Credits,,,
-Author Name,Insert Your Name,"Appears in map credits as ""View data by..."" (or leave blank)",
-Author Email or Website,,Create link in Author Name by inserting your email or web address (or leave blank),
-Author GitHub Repo Link,https://github.com/handsondataviz/leaflet-storymaps-with-google-sheets,"Insert your code repo URL to appear as link in ""View code..."" (or leave blank)",
-Code Credit,"HandsOnDataViz","Appears in credits as ""...code by..."" (or leave blank)",
\ No newline at end of file
diff --git a/index.html b/index.html
index 0c440b2a..b8127498 100644
--- a/index.html
+++ b/index.html
@@ -9,11 +9,14 @@
+ integrity="sha512-xodZBNTC5n17Xt2atTPuE1HxjVMSvLVW9ocqUKLsCC5CXdbqCmblAshOMAS6/keqq/sMZMZ19scR4PsZChSR7A=="
+ crossorigin=""/>
+ integrity="sha512-XQoYMqMTK8LvdxXYG3nZ448hOEQiglfqkJs1NOQV44cWnUrBc8PkAOcXy20w0vlaXaVUearIOBhiXZ5V3ynxwA=="
+ crossorigin="">
+
+
+
@@ -56,7 +59,6 @@
-
diff --git a/scripts/storymap.js b/scripts/storymap.js
index 43df5fa8..6965d142 100644
--- a/scripts/storymap.js
+++ b/scripts/storymap.js
@@ -10,43 +10,49 @@ $(window).on('load', function() {
scrollPosition = $(this).scrollTop();
});
- var parse = function(res) {
- return Papa.parse(Papa.unparse(res[0].values), {header: true} ).data;
- }
-
- // First, try reading data from the Google Sheet
- if (typeof googleDocURL !== 'undefined' && googleDocURL) {
+ // First, try reading Options.csv
+ $.get('csv/Options.csv', function(options) {
- if (typeof googleApiKey !== 'undefined' && googleApiKey) {
+ $.get('csv/Chapters.csv', function(chapters) {
+ initMap(
+ $.csv.toObjects(options),
+ $.csv.toObjects(chapters)
+ )
+ }).fail(function(e) { alert('Found Options.csv, but could not read Chapters.csv') });
- var apiUrl = 'https://sheets.googleapis.com/v4/spreadsheets/'
- var spreadsheetId = googleDocURL.split('/d/')[1].split('/')[0];
+ // If not available, try from the Google Sheet
+ }).fail(function(e) {
- $.when(
- $.getJSON(apiUrl + spreadsheetId + '/values/Options?key=' + googleApiKey),
- $.getJSON(apiUrl + spreadsheetId + '/values/Chapters?key=' + googleApiKey),
- ).then(function(options, chapters) {
- initMap(parse(options), parse(chapters))
- })
+ var parse = function(res) {
+ return Papa.parse(Papa.unparse(res[0].values), {header: true} ).data;
+ }
+
+ // First, try reading data from the Google Sheet
+ if (typeof googleDocURL !== 'undefined' && googleDocURL) {
+
+ if (typeof googleApiKey !== 'undefined' && googleApiKey) {
+
+ var apiUrl = 'https://sheets.googleapis.com/v4/spreadsheets/'
+ var spreadsheetId = googleDocURL.split('/d/')[1].split('/')[0];
+
+ $.when(
+ $.getJSON(apiUrl + spreadsheetId + '/values/Options?key=' + googleApiKey),
+ $.getJSON(apiUrl + spreadsheetId + '/values/Chapters?key=' + googleApiKey),
+ ).then(function(options, chapters) {
+ initMap(parse(options), parse(chapters))
+ })
+
+ } else {
+ alert('You load data from a Google Sheet, you need to add a free Google API key')
+ }
} else {
- alert('You load data from a Google Sheet, you need to add a free Google API key')
+ alert('You need to specify a valid Google Sheet (googleDocURL)')
}
+
+ })
- }
- // Else, try csv/Options.csv and csv/Chapters.csv
- else {
- $.get('csv/Options.csv', function(options) {
- $.get('csv/Chapters.csv', function(chapters) {
- initMap(
- $.csv.toObjects(options),
- $.csv.toObjects(chapters)
- )
- }).fail(function(e) { alert('Could not read Chapters.csv') });
- }).fail(function(e) { alert('Could not read Options.csv') })
- }
-
/**
* Reformulates documentSettings as a dictionary, e.g.