2015-05-25 22:15:46 +02:00
|
|
|
$(ASAP = function() {
|
2013-11-23 21:53:52 +01:00
|
|
|
|
2013-11-30 17:13:19 +01:00
|
|
|
siteNavigation.init();
|
2015-06-08 10:53:12 +02:00
|
|
|
//siteEffects.init();
|
2014-07-03 18:53:39 +02:00
|
|
|
|
2013-11-23 21:53:52 +01:00
|
|
|
});
|
|
|
|
|
2015-05-25 22:15:46 +02:00
|
|
|
$(window).load(AfterLoad = function() {
|
2014-07-03 18:53:39 +02:00
|
|
|
|
2014-03-10 21:52:30 +01:00
|
|
|
photoGrid.init();
|
2014-07-03 18:53:39 +02:00
|
|
|
|
2013-11-23 21:53:52 +01:00
|
|
|
});
|
|
|
|
|
2013-11-30 17:13:19 +01:00
|
|
|
var siteNavigation = {
|
2014-07-03 18:53:39 +02:00
|
|
|
|
2013-11-30 17:13:19 +01:00
|
|
|
siteSearch: function() {
|
2014-07-03 18:53:39 +02:00
|
|
|
|
2015-08-10 00:48:31 +02:00
|
|
|
var $content = $('.site__content'),
|
2015-08-09 18:15:40 +02:00
|
|
|
$searchlink = $('.search-btn'),
|
2015-08-10 00:48:31 +02:00
|
|
|
$searcharea = $('.search-area'),
|
2015-08-09 18:15:40 +02:00
|
|
|
$searchfield = $('#search-input'),
|
|
|
|
$searchresults = $('#search-results'),
|
|
|
|
$searchpop = $('#search-popover');
|
|
|
|
|
|
|
|
// revert all search elements
|
|
|
|
function hideSearch() {
|
|
|
|
$searcharea.removeClass('slideDown').addClass('bounceOutUp');
|
|
|
|
$searchpop.addClass('hide');
|
|
|
|
$content.removeClass('search-open-blur');
|
|
|
|
}
|
2014-07-03 18:53:39 +02:00
|
|
|
|
2015-05-25 22:15:46 +02:00
|
|
|
$searchlink.click(function(e) {
|
2015-05-29 02:39:53 +02:00
|
|
|
e.preventDefault()
|
2014-07-03 18:53:39 +02:00
|
|
|
|
2015-05-25 22:15:46 +02:00
|
|
|
SimpleJekyllSearch({
|
2015-08-09 18:15:40 +02:00
|
|
|
searchInput: document.getElementById('search-input'),
|
|
|
|
resultsContainer: document.getElementById('search-results'),
|
2015-05-25 22:15:46 +02:00
|
|
|
json: '/search.json',
|
2015-08-10 00:48:31 +02:00
|
|
|
searchResultTemplate: '<li class="grid__col"><a class="search-link" href="{url}">{title}</a></li>',
|
2015-08-09 18:15:40 +02:00
|
|
|
fuzzy: false
|
2015-05-25 22:15:46 +02:00
|
|
|
})
|
2014-07-03 18:53:39 +02:00
|
|
|
|
2015-08-09 18:15:40 +02:00
|
|
|
// show search field
|
2014-08-10 00:26:08 +02:00
|
|
|
$searcharea.removeClass('ready bounceOutUp').addClass('ready slideDown');
|
2013-12-01 00:47:47 +01:00
|
|
|
$searchfield.focus();
|
2015-08-09 18:15:40 +02:00
|
|
|
|
|
|
|
// blur the content
|
|
|
|
$content.addClass('search-open-blur');
|
|
|
|
|
|
|
|
// show search results upon typing
|
2015-05-25 22:15:46 +02:00
|
|
|
if ($searchfield.val().length) {
|
2013-12-04 20:54:40 +01:00
|
|
|
$searchpop.removeClass('hide');
|
|
|
|
}
|
2014-07-03 18:53:39 +02:00
|
|
|
|
2013-12-01 00:47:47 +01:00
|
|
|
// hide menu too just in case
|
2015-05-25 22:15:46 +02:00
|
|
|
if ($('body').hasClass('menu-open')) {
|
2013-12-03 23:39:48 +01:00
|
|
|
$('body').removeClass('menu-open');
|
2013-12-01 00:47:47 +01:00
|
|
|
}
|
2014-07-03 18:53:39 +02:00
|
|
|
|
2013-12-01 00:47:47 +01:00
|
|
|
// bind the hide controls
|
|
|
|
$(document).bind('click.hidethepop', function() {
|
2015-08-09 18:15:40 +02:00
|
|
|
hideSearch();
|
2014-07-03 18:53:39 +02:00
|
|
|
|
2013-12-01 00:47:47 +01:00
|
|
|
// unbind the hide controls
|
|
|
|
$(document).unbind('click.hidethepop');
|
|
|
|
});
|
2014-07-03 18:53:39 +02:00
|
|
|
|
2013-12-04 20:57:34 +01:00
|
|
|
// dont close thepop when click on thepop
|
2013-12-01 00:47:47 +01:00
|
|
|
$searchpop.click(function(e) {
|
|
|
|
e.stopPropagation();
|
|
|
|
});
|
2013-12-04 20:57:34 +01:00
|
|
|
// dont close thepop when click on search field
|
|
|
|
$searchfield.click(function(e) {
|
|
|
|
e.stopPropagation();
|
|
|
|
});
|
2014-07-03 18:53:39 +02:00
|
|
|
|
|
|
|
// and dont close thepop now
|
2013-12-01 00:47:47 +01:00
|
|
|
e.stopPropagation();
|
|
|
|
});
|
2014-07-03 18:53:39 +02:00
|
|
|
|
2013-12-04 20:54:40 +01:00
|
|
|
// finally show popup upon first keypress
|
|
|
|
$searchfield.on('keyup', function() {
|
|
|
|
$searchpop.removeClass('hide');
|
|
|
|
});
|
2014-07-03 18:53:39 +02:00
|
|
|
|
2013-12-04 20:54:40 +01:00
|
|
|
// close button
|
2015-05-25 22:15:46 +02:00
|
|
|
$('.search-close').click(function(e) {
|
2013-12-01 00:47:47 +01:00
|
|
|
e.preventDefault();
|
2014-07-03 18:53:39 +02:00
|
|
|
|
2015-08-09 18:15:40 +02:00
|
|
|
hideSearch();
|
2014-07-03 18:53:39 +02:00
|
|
|
|
2013-12-01 00:47:47 +01:00
|
|
|
// empty search field
|
|
|
|
$searchfield.val('').blur();
|
|
|
|
});
|
2013-11-30 17:13:19 +01:00
|
|
|
},
|
2014-07-03 18:53:39 +02:00
|
|
|
|
2013-11-30 17:13:19 +01:00
|
|
|
siteMenu: function() {
|
2013-12-01 00:47:47 +01:00
|
|
|
var $thelink = $('.menu-btn'),
|
2015-08-09 21:50:06 +02:00
|
|
|
$thepop = $('.nav-popover');
|
2014-07-03 18:53:39 +02:00
|
|
|
|
2015-05-25 22:15:46 +02:00
|
|
|
$thelink.click(function(e) {
|
2013-12-01 00:47:47 +01:00
|
|
|
e.preventDefault();
|
2014-07-03 18:53:39 +02:00
|
|
|
|
2013-12-01 16:00:12 +01:00
|
|
|
// toggle menu
|
2013-12-03 23:39:48 +01:00
|
|
|
$('body').toggleClass('menu-open');
|
2014-07-03 18:53:39 +02:00
|
|
|
|
2015-05-25 22:15:46 +02:00
|
|
|
if ($('body').hasClass('menu-open')) {
|
2013-12-07 17:52:43 +01:00
|
|
|
$thepop.removeClass('hide');
|
|
|
|
} else {
|
|
|
|
$thepop.addClass('hide');
|
|
|
|
}
|
|
|
|
|
2013-12-01 00:47:47 +01:00
|
|
|
// bind the hide controls
|
2013-12-03 23:39:48 +01:00
|
|
|
$(document).bind('click.hidethepop', function() {
|
2014-07-03 18:53:39 +02:00
|
|
|
$('body').removeClass('menu-open');
|
|
|
|
$thepop.toggleClass('hide');
|
|
|
|
// unbind the hide controls
|
|
|
|
$(document).unbind('click.hidethepop');
|
2013-12-01 00:47:47 +01:00
|
|
|
});
|
2014-07-03 18:53:39 +02:00
|
|
|
|
2013-12-01 00:47:47 +01:00
|
|
|
// dont close thepop when you click on thepop
|
|
|
|
$thepop.click(function(e) {
|
|
|
|
e.stopPropagation();
|
|
|
|
});
|
2014-07-03 18:53:39 +02:00
|
|
|
|
|
|
|
// and dont close thepop now
|
2013-12-01 00:47:47 +01:00
|
|
|
e.stopPropagation();
|
|
|
|
});
|
2013-11-30 17:13:19 +01:00
|
|
|
},
|
2014-07-03 18:53:39 +02:00
|
|
|
|
2015-05-25 22:15:46 +02:00
|
|
|
init: function() {
|
|
|
|
this.siteSearch();
|
2013-11-30 17:13:19 +01:00
|
|
|
this.siteMenu();
|
2015-05-25 22:15:46 +02:00
|
|
|
}
|
2013-11-30 17:13:19 +01:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2013-11-29 21:36:09 +01:00
|
|
|
var photoGrid = {
|
|
|
|
|
|
|
|
masonryLayout: function() {
|
|
|
|
var $container = $('#main .masonry');
|
2014-07-03 18:53:39 +02:00
|
|
|
|
2015-05-25 22:15:46 +02:00
|
|
|
$container.imagesLoaded(function() {
|
2013-11-29 21:36:09 +01:00
|
|
|
$container.masonry({
|
2015-05-25 22:15:46 +02:00
|
|
|
itemSelector: 'article',
|
|
|
|
columnWidth: '.grid-sizer'
|
2013-11-29 21:36:09 +01:00
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
2015-05-25 22:15:46 +02:00
|
|
|
init: function() {
|
2013-11-29 21:36:09 +01:00
|
|
|
// only fire when photo page present and screen bigger than 480px
|
2015-05-25 22:15:46 +02:00
|
|
|
if ($('.page-photos').length > 0) {
|
2013-11-29 21:36:09 +01:00
|
|
|
this.masonryLayout();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2013-11-23 21:53:52 +01:00
|
|
|
|
|
|
|
var siteEffects = {
|
2014-07-03 18:53:39 +02:00
|
|
|
|
2015-05-25 22:15:46 +02:00
|
|
|
init: function() {
|
2015-05-29 02:39:53 +02:00
|
|
|
|
2015-05-25 22:15:46 +02:00
|
|
|
}
|
2013-11-23 21:53:52 +01:00
|
|
|
|
|
|
|
}
|