From 476f75551f15b136c7e990337f3cb19960977eb9 Mon Sep 17 00:00:00 2001 From: Jack Reed Date: Fri, 14 Oct 2016 17:15:18 -0400 Subject: [PATCH] add an embedable version --- examples/index.html | 15 +++++++++++++++ examples/index.js | 16 ++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 examples/index.html create mode 100644 examples/index.js diff --git a/examples/index.html b/examples/index.html new file mode 100644 index 0000000..c1f17b5 --- /dev/null +++ b/examples/index.html @@ -0,0 +1,15 @@ + + + + + + + + + + +
+
+ + + \ No newline at end of file diff --git a/examples/index.js b/examples/index.js new file mode 100644 index 0000000..df8f083 --- /dev/null +++ b/examples/index.js @@ -0,0 +1,16 @@ +var map; + +map = L.map('map', { + center: [0, 0], + crs: L.CRS.Simple, + zoom: 0 +}); + +var url = window.location.search.replace('?url=', '') + +// http://stackoverflow.com/a/18222306 +var urlregex = /^(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?$/; + +if (urlregex.test(url)) { + layer = L.tileLayer.iiif(url, {}).addTo(map); +}