Skip to content

Commit

Permalink
integrate #491 and changes to force away from obsolete stamen map types
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeGermuska committed Dec 7, 2023
1 parent a10512c commit 6b27619
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 12 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "StoryMapJS",
"version": "0.9.3",
"version": "0.9.4",
"description": "StoryMapJS is a tool for telling stories through the context of places on a map. For more information, see storymap.knightlab.com",
"private": "true",
"directories": {
Expand Down
26 changes: 20 additions & 6 deletions src/js/storymap/StoryMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,18 @@ class StoryMap {
this.options.calculate_zoom = false;
}

// Use relative date calculations?
// handle Stamen change
if (this.options.map_type.indexOf('stamen') == 0) {
const old_type = this.options.map_type
if (old_type == 'stamen:watercolor') {
this.options.map_type = 'ch-watercolor'
} else {
this.options.map_type = 'osm:standard'
}
console.log(`Deprecated map_type ${old_type}; using ${this.options.map_type}`)
}

// Use relative date calculations?
if(this.options.relative_date) {
if (typeof(moment) !== 'undefined') {
self._loadLanguage();
Expand Down Expand Up @@ -541,11 +552,14 @@ class StoryMap {
}
}

// TODO. what is this?
//(function(_) {
// var scripts = document.getElementsByTagName("script"),
// src = scripts[scripts.length-1].src;
// _.SCRIPT_PATH = src.substr(0,src.lastIndexOf("/"));
// Calculates the script path and sets it as SCRIPT_PATH on the StoryMap class
(function(StoryMapClass) {
var scripts = document.getElementsByTagName("script");
if (scripts.length > 0) {
var src = scripts[scripts.length - 1].src;
StoryMapClass.SCRIPT_PATH = src.substring(0, src.lastIndexOf("/"));
}
})(StoryMap);

classMixin(StoryMap, Events)
export { StoryMap }
3 changes: 2 additions & 1 deletion src/template/football.json
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@
],
"call_to_action_text": "",
"map_as_image": false,
"map_subdomains": ""
"map_subdomains": "",
"map_type": "stamen:watercolor"
}
}
6 changes: 2 additions & 4 deletions storymap/templates/edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -1597,10 +1597,8 @@

if (!map_type) {
// many storymaps have no explicit map type set.
// As stamen maps become un-free, this is unfortunate.
// For now, fill it in with this, even though it's deprecated.
// Eventually we'll default to osm:standard instead
_storymap_data.storymap.map_type = 'stamen:toner-lite'
// that was a mistake, but so it goes.
_storymap_data.storymap.map_type = 'osm:standard'
}


Expand Down

0 comments on commit 6b27619

Please sign in to comment.