2022-11-19 18:50:00 +00:00
|
|
|
openPerson = false
|
|
|
|
|
|
|
|
$(() => {
|
2022-11-20 19:30:15 +00:00
|
|
|
// Detect page URL
|
|
|
|
path = window.location.pathname.replace(/\//g, '')
|
|
|
|
if (path == 'jason' || path == 'flo' || path == 'lucy') {
|
|
|
|
// A specific path has been set. Display the profile for that person
|
|
|
|
openPerson = path
|
2022-11-20 20:10:10 +00:00
|
|
|
immediateOpen(openPerson)
|
2022-11-20 19:30:15 +00:00
|
|
|
}
|
|
|
|
|
2022-11-20 19:42:51 +00:00
|
|
|
// Listen for pop states
|
|
|
|
window.onpopstate = function(event) {
|
|
|
|
path = window.location.pathname.replace(/\//g, '')
|
|
|
|
//alert(path)
|
2022-11-20 20:10:10 +00:00
|
|
|
|
|
|
|
if (path == '' && openPerson) {
|
|
|
|
animateClose(openPerson)
|
|
|
|
openPerson = false
|
|
|
|
} else if (!openPerson && (path == 'jason' || path == 'flo')) {
|
|
|
|
openPerson = path
|
|
|
|
animateOpen(openPerson)
|
|
|
|
}
|
2022-11-20 19:42:51 +00:00
|
|
|
};
|
|
|
|
|
2022-11-20 19:30:15 +00:00
|
|
|
// Handle clicks on profile links (by doing nothing)
|
2022-11-19 18:50:00 +00:00
|
|
|
$('a.openlink').click(function(e) {
|
|
|
|
e.preventDefault();
|
|
|
|
})
|
|
|
|
|
2022-11-20 19:30:15 +00:00
|
|
|
// Handle clicks on the banner
|
2022-11-19 18:50:00 +00:00
|
|
|
$('div.banner').click(function() {
|
2022-11-20 20:10:10 +00:00
|
|
|
// If there's no person to open, do nothing
|
2022-11-20 19:30:15 +00:00
|
|
|
if (typeof $(this).attr('data-person') == 'undefined') return;
|
|
|
|
|
2022-11-19 18:50:00 +00:00
|
|
|
if (!openPerson) {
|
2022-11-20 20:10:10 +00:00
|
|
|
// If no profile is open, open one, and push a new page URL
|
2022-11-19 18:50:00 +00:00
|
|
|
openPerson = $(this).attr('data-person')
|
2022-11-20 20:10:10 +00:00
|
|
|
animateOpen(openPerson)
|
|
|
|
window.history.pushState({ id: "100" }, '', '/' + openPerson);
|
2022-11-19 18:50:00 +00:00
|
|
|
} else {
|
2022-11-20 20:10:10 +00:00
|
|
|
// If a profile is open, close it, and push a new page URL
|
|
|
|
animateClose(openPerson)
|
|
|
|
openPerson = false
|
|
|
|
window.history.pushState({ id: "100" }, '', '/');
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
// Immediately open the content for a defined person, with only the display of links being animated
|
|
|
|
function immediateOpen(p) {
|
|
|
|
$('.main.not' + p).css({
|
|
|
|
width: 0,
|
|
|
|
height: 0,
|
|
|
|
minHeight: 0
|
|
|
|
})
|
|
|
|
|
|
|
|
$('#main-' + p).css('min-height', '100vh')
|
|
|
|
|
|
|
|
$('#splash-' + p).css({
|
|
|
|
width: '50vw',
|
|
|
|
height: '100vh'
|
|
|
|
})
|
|
|
|
|
|
|
|
animateLinks(p)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Animate the opening of content for a defined person
|
|
|
|
function animateOpen(p) {
|
|
|
|
if (window.matchMedia('(orientation: portrait)').matches) {
|
|
|
|
// If we're opening in portrait mode...
|
|
|
|
$('.main.not' + p).css({
|
|
|
|
height: '50vh',
|
|
|
|
minHeight: 0
|
|
|
|
})
|
|
|
|
|
|
|
|
$('.main.not' + p).animate({
|
2022-11-19 21:11:59 +00:00
|
|
|
height: 0
|
|
|
|
}, {
|
|
|
|
duration: 300,
|
2022-11-20 20:10:10 +00:00
|
|
|
queue: false
|
2022-11-19 21:11:59 +00:00
|
|
|
})
|
|
|
|
|
2022-11-20 20:10:10 +00:00
|
|
|
$('#main-' + p).animate({
|
|
|
|
minHeight: '100vh'
|
|
|
|
}, {
|
|
|
|
duration: 300,
|
|
|
|
queue: true,
|
|
|
|
complete: () => {
|
|
|
|
$('.main.not' + p).css('width', 0)
|
|
|
|
$('#splash-' + p).css({
|
|
|
|
width: '50vw',
|
|
|
|
height: '100vh'
|
|
|
|
})
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
} else {
|
|
|
|
// If we're opening in landscape mode...
|
|
|
|
$('#splash-' + p).css('height', '100vh')
|
|
|
|
|
|
|
|
$('.main.not' + p).animate({
|
|
|
|
width: 0
|
|
|
|
}, {
|
|
|
|
duration: 300,
|
|
|
|
queue: false
|
|
|
|
})
|
|
|
|
|
|
|
|
$('#splash-' + p).animate({
|
|
|
|
width: '50vw'
|
|
|
|
}, {
|
|
|
|
duration: 300,
|
|
|
|
queue: true,
|
|
|
|
complete: () => {
|
|
|
|
$('.main.not' + p).css({
|
|
|
|
height: 0,
|
|
|
|
minHeight: 0
|
|
|
|
})
|
|
|
|
}
|
|
|
|
})
|
2022-11-19 18:50:00 +00:00
|
|
|
}
|
2022-11-20 20:10:10 +00:00
|
|
|
|
|
|
|
// Display the links
|
|
|
|
setTimeout(() => {
|
|
|
|
animateLinks(p)
|
|
|
|
}, 300)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Animate the closure of a defined person's profile
|
|
|
|
function animateClose(p) {
|
|
|
|
$('#links-' + p).animate({
|
|
|
|
height: 0
|
|
|
|
}, {
|
|
|
|
duration: 300,
|
|
|
|
queue: true
|
|
|
|
})
|
|
|
|
|
|
|
|
if (window.matchMedia('(orientation: portrait)').matches) {
|
|
|
|
// If we're closing in portrait mode...
|
|
|
|
$('.main.not' + p).css('width', '100vw')
|
|
|
|
|
|
|
|
$('#main-' + p).animate({
|
|
|
|
minHeight: '50vh'
|
|
|
|
}, {
|
|
|
|
duration: 300,
|
|
|
|
queue: false
|
|
|
|
})
|
|
|
|
|
|
|
|
$('.main.not' + p).animate({
|
|
|
|
height: '50vh'
|
|
|
|
}, {
|
|
|
|
duration: 300,
|
|
|
|
queue: false,
|
|
|
|
complete: () => {
|
|
|
|
$('.main, .splash').removeAttr('style')
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
} else {
|
|
|
|
// If we're closing in landscape mode...
|
|
|
|
$('.main.not' + p).css('height', '100vh')
|
|
|
|
|
|
|
|
$('#splash-' + p).animate({
|
|
|
|
width: 0
|
|
|
|
}, {
|
|
|
|
duration: 300,
|
|
|
|
queue: false
|
|
|
|
})
|
|
|
|
|
|
|
|
$('.main.not' + p).animate({
|
|
|
|
width: '50vw'
|
|
|
|
}, {
|
|
|
|
duration: 300,
|
|
|
|
queue: false,
|
|
|
|
complete: () => {
|
|
|
|
$('.main, .splash').removeAttr('style')
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Animate the display of links for a defined person
|
|
|
|
function animateLinks(p) {
|
|
|
|
$('#links-' + p).animate({
|
|
|
|
height: $('#links-' + p).get(0).scrollHeight
|
|
|
|
}, {
|
|
|
|
duration: 300,
|
|
|
|
queue: true
|
|
|
|
})
|
|
|
|
}
|
2022-11-19 18:50:00 +00:00
|
|
|
})
|