Created
August 10, 2020 23:24
-
-
Save jrue/f4b5a8dfea8679caa80dbcdbfc644ac5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype><html><head> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<title>Odyssey.js Slides</title> | |
<meta name="description" content=""> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<link rel="icon" type="image/x-icon" href="https://cartodb.github.io/odyssey.js/editor/favicon.png"> | |
<link rel="icon" type="image/png" href="https://cartodb.github.io/odyssey.js/editor/favicon.png"> | |
<link rel="stylesheet" href="https://d19vzq90twjlae.cloudfront.net/leaflet-0.7.2/leaflet.css"> | |
<link rel="stylesheet" href="https://cartodb.github.io/odyssey.js/editor/css/slides.css"> | |
<script src="https://cartodb.github.io/odyssey.js/vendor/modernizr-2.6.2.min.js"></script> | |
</head> | |
<body> | |
<div id="map" style="width: 100%; height: 100%;"></div> | |
<div id="slides_container" style="display:block;"> | |
<div id="dots"></div> | |
<div id="slides"></div> | |
<ul id="navButtons"> | |
<li><a class="prev"></a></li> | |
<li><a class="next"></a></li> | |
</ul> | |
</div> | |
<div id="credits"> | |
<span class="title" id="title">Title</span> | |
<span class="author"><strong id="author">By Name using</strong> <a href="#">Odyssey.js</a><span> | |
</span></span></div> | |
<script src="https://code.jquery.com/jquery-1.11.0.min.js"></script> | |
<script src="https://d19vzq90twjlae.cloudfront.net/leaflet-0.7.2/leaflet.js"></script> | |
<script src="https://cartodb.github.io/odyssey.js/dist/odyssey.js" charset="UTF-8"></script> | |
<script> | |
var resizePID; | |
function clearResize() { | |
clearTimeout(resizePID); | |
resizePID = setTimeout(function() { adjustSlides(); }, 100); | |
} | |
if (!window.addEventListener) { | |
window.attachEvent("resize", function load(event) { | |
clearResize(); | |
}); | |
} else { | |
window.addEventListener("resize", function load(event) { | |
clearResize(); | |
}); | |
} | |
function adjustSlides() { | |
var container = document.getElementById("slides_container"), | |
slide = document.querySelectorAll('.selected_slide')[0]; | |
if (slide) { | |
if (slide.offsetHeight+169+40+80 >= window.innerHeight) { | |
container.style.bottom = "80px"; | |
var h = container.offsetHeight; | |
slide.style.height = h-169+"px"; | |
slide.classList.add("scrolled"); | |
} else { | |
container.style.bottom = "auto"; | |
container.style.minHeight = "0"; | |
slide.style.height = "auto"; | |
slide.classList.remove("scrolled"); | |
} | |
} | |
} | |
var resizeAction = O.Action(function() { | |
function imageLoaded() { | |
counter--; | |
if (counter === 0) { | |
adjustSlides(); | |
} | |
} | |
var images = $('img'); | |
var counter = images.length; | |
images.each(function() { | |
if (this.complete) { | |
imageLoaded.call( this ); | |
} else { | |
$(this).one('load', imageLoaded); | |
} | |
}); | |
}); | |
function click(el) { | |
var element = O.Core.getElement(el); | |
var t = O.Trigger(); | |
// TODO: clean properly | |
function click() { | |
t.trigger(); | |
} | |
if (element) element.onclick = click; | |
return t; | |
} | |
O.Template({ | |
init: function() { | |
var seq = O.Triggers.Sequential(); | |
var baseurl = this.baseurl = 'http://{s}.api.cartocdn.com/base-light/{z}/{x}/{y}.png'; | |
var map = this.map = L.map('map').setView([0, 0.0], 4); | |
var basemap = this.basemap = L.tileLayer(baseurl, { | |
attribution: 'data OSM - map CartoDB' | |
}).addTo(map); | |
// enanle keys to move | |
O.Keys().on('map').left().then(seq.prev, seq) | |
O.Keys().on('map').right().then(seq.next, seq) | |
click(document.querySelectorAll('.next')).then(seq.next, seq) | |
click(document.querySelectorAll('.prev')).then(seq.prev, seq) | |
var slides = O.Actions.Slides('slides'); | |
var story = O.Story() | |
this.story = story; | |
this.seq = seq; | |
this.slides = slides; | |
this.progress = O.UI.DotProgress('dots').count(0); | |
}, | |
update: function(actions) { | |
if (!actions.length) return; | |
this.story.clear(); | |
if (this.baseurl && (this.baseurl !== actions.global.baseurl)) { | |
this.baseurl = actions.global.baseurl || 'http://0.api.cartocdn.com/base-light/{z}/{x}/{y}.png'; | |
this.basemap.setUrl(this.baseurl); | |
} | |
// update footer title and author | |
var title_ = actions.global.title === undefined ? '' : actions.global.title, | |
author_ = actions.global.author === undefined ? 'Using' : 'By '+actions.global.author+' using'; | |
document.getElementById('title').innerHTML = title_; | |
document.getElementById('author').innerHTML = author_; | |
document.title = title_ + " | " + author_ +' Odyssey.js'; | |
var sl = actions; | |
document.getElementById('slides').innerHTML = '' | |
this.progress.count(sl.length); | |
// create new story | |
for(var i = 0; i < sl.length; ++i) { | |
var slide = sl[i]; | |
var tmpl = "<div class='slide' style='diplay:none'>"; | |
tmpl += slide.html(); | |
tmpl += "</div>"; | |
document.getElementById('slides').innerHTML += tmpl; | |
this.progress.step(i).then(this.seq.step(i), this.seq) | |
var actions = O.Parallel( | |
this.slides.activate(i), | |
slide(this), | |
this.progress.activate(i), | |
resizeAction | |
); | |
actions.on("finish.app", function() { | |
adjustSlides(); | |
}); | |
this.story.addState( | |
this.seq.step(i), | |
actions | |
) | |
} | |
this.story.go(this.seq.current()); | |
}, | |
changeSlide: function(n) { | |
this.seq.current(n); | |
} | |
}); | |
</script><script id="md_template" type="text/template">``` | |
-baseurl: "https://cartocdn_a.global.ssl.fastly.net/base-light/{z}/{x}/{y}.png" | |
-title: "Dad's Move" | |
-author: "CartoDB" | |
``` | |
#Pallan's Home | |
``` | |
- center: [19.0760, 72.8777] | |
- zoom: 5 | |
L.marker([19.0760, 72.8777]).actions.addRemove(S.map) | |
``` | |
Pallan grew up in Mumbai, India, formerly known as Bombay before it was renamed to remove connotations of British colonial rule in India. | |
#Pallan's Big Move | |
``` | |
- center: [40.7348, -73.9970] | |
- zoom: 3 | |
L.marker([40.7348, -73.9970]).actions.addRemove(S.map) | |
``` | |
Leaving home at the age of 18, Pallan traveled to the United States to give tours to vacationers and make a living | |
#Finding Love | |
``` | |
- center: [40.7365, -73.9982] | |
- zoom: 13 | |
L.marker([40.7365, -73.9982]).actions.addRemove(S.map) | |
``` | |
Pallan met Carol Chaky at a travel-businesses work party in New York City. | |
 | |
#Long Island Family | |
``` | |
- center: [40.6546, -73.5594] | |
- zoom: 9 | |
L.marker([40.6546, -73.5594]).actions.addRemove(S.map) | |
``` | |
Lived out the American dream on Long Island where he and Carol had two children, Dina and Tyler. | |
#Florida Dreaming | |
``` | |
- center: [26.3683, -80.1289] | |
- zoom: 9 | |
L.marker([26.3683, -80.1289]).actions.addRemove(S.map) | |
``` | |
After a concussion from slipping on ice in New York, Pallan moved his family out to the sunny state of Florida where he resides today | |
<script id="md_template" type="text/template"> | |
</script></body></html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment