Skip to content

Commit

Permalink
adds aliases to deprecated references for old embed support
Browse files Browse the repository at this point in the history
  • Loading branch information
scott2b committed Mar 8, 2021
1 parent d8d81c8 commit 5f7d441
Show file tree
Hide file tree
Showing 8 changed files with 65 additions and 12 deletions.
6 changes: 6 additions & 0 deletions README_DOCKER.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,9 @@ $ docker-compose up
```
$ docker-compose run pg psql -h pg -U storymap
```

### Using aws cli with localstack

```
$ aws --endpoint-url=http://localhost:4566 s3 ls s3://uploads.knilab.com/storymapjs/
```
6 changes: 6 additions & 0 deletions deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ To stage the current dist folder:
A stg deployment will always deploy the specified branch to the stg endpoint in the CDN:
s3://cdn.knightlab.com/libs/storymapjs/stg/

To create a versioned endpoint, create a tag:

```
$ git tag -a <version> -m "deployment version"
$ git push origin --tags
```

To deploy to a specific versioned endpoint, specify prd:

Expand Down
1 change: 0 additions & 1 deletion nginx/conf.d/StoryMapJS.conf
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ server {

location @proxy_to_storymap {
proxy_pass http://127.0.0.1:9014;
#proxy_pass http://unix:/usr/src/apps/StoryMapJS/mnt/StoryMapJS.sock;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
Expand Down
13 changes: 12 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
},
"dependencies": {
"leaflet": "^0.7.2",
"trash-cli": "^4.0.0",
"uglify-js": "^2.8.29"
},
"devDependencies": {
Expand All @@ -21,12 +22,22 @@
"jstrace": "^0.3.0",
"less": "^3.13.0",
"less-loader": "^7.1.0",
"npm-run-all": "^4.1.5",
"run-all": "^1.0.1",
"run-s": "0.0.0",
"style-loader": "^2.0.0",
"trash": "^7.1.0",
"webpack": "^5.11.0",
"webpack-cli": "^4.4.0"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"build": "webpack --config webpack.prd.js && node tasks/compile_less.js",
"clean": "trash dist",
"test": "echo \"Error: no test specified\" && exit 1",
"dist": "npm-run-all -s clean build",
"stage": "npm run dist && node tasks/stage.js",
"stage_latest": "npm run dist && node tasks/stage.js latest",
"stage_dev": "npm run dist && node tasks/stage.js dev"
},
"repository": {
"type": "git",
Expand Down
35 changes: 35 additions & 0 deletions src/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,38 @@ export { setLanguage } from "./language/Language"

import ZoomifyTileLayer from "./map/leaflet/extensions/Leaflet.TileLayer.Zoomify"
export { ZoomifyTileLayer }

/* Transitional references deprecated as of 0.7.7 */
function trace(msg) {
console.log(msg);
}
window.trace = trace;


function getJSON(url, onload) {
let httpRequest = new XMLHttpRequest();
httpRequest.onreadystatechange = function() {
if (httpRequest.readyState === XMLHttpRequest.DONE) {
if (httpRequest.status === 200) {
let data = JSON.parse(httpRequest.responseText);
onload(data);
} else {
alert('There was a problem with the request.');
}
}
};
httpRequest.open('GET', url);
httpRequest.send();
}

import { loadCSS } from "./core/Load"
import { StoryMap } from "./storymap/StoryMap"

const VCO = {
Load: {
css: loadCSS
},
getJSON: getJSON,
StoryMap: StoryMap
}
window.VCO = VCO;
11 changes: 5 additions & 6 deletions src/js/storymap/StoryMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,12 +157,11 @@ class StoryMap {
var self = this;

if (typeof data === 'string') {
getJSON(data, function(d) {
if (d && d.storymap) {
mergeData(self.data, d.storymap);
}
self._initOptions();
});
fetch(data)
.then(response => response.json())
.then(result => {
console.log(result);
});
} else if (typeof data === 'object') {
if (data.storymap) {
self.data = data.storymap;
Expand Down
2 changes: 1 addition & 1 deletion storymap/templates/_demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</div>
</section>
<script>
var storymap = new VCO.StoryMap('homepage-storymap',
var storymap = new KLStoryMap.StoryMap('homepage-storymap',
'{{ STATIC_URL }}demo/demo.json');

var e = $(window).height(),
Expand Down
3 changes: 0 additions & 3 deletions tasks/stage.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@ function stageToCDN(version, latest) {
// })
// }

// backwards compatibility -- we've offered timeline-min.js
// webpack makes something smaller even than that, so just copy.
// for people who want to debug, there's the sourcemap.
fse.copySync('dist/js/storymap.js', 'dist/js/storymap-min.js')

if (fse.existsSync(CDN_ROOT)) {
Expand Down

0 comments on commit 5f7d441

Please sign in to comment.