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();
|
2013-12-16 01:41:20 +01: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-05-25 22:15:46 +02:00
|
|
|
var $searchlink = $('.search-btn'),
|
|
|
|
$searcharea = $('.topbar .search-area'),
|
|
|
|
$searchfield = $('.search-field'),
|
|
|
|
$searchresults = $('.search-results'),
|
|
|
|
$searchpop = $('.popover');
|
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
|
|
|
|
2013-12-28 16:22:36 +01:00
|
|
|
// init jekyll search
|
2015-05-25 22:15:46 +02:00
|
|
|
SimpleJekyllSearch({
|
|
|
|
searchInput: $searchfield,
|
|
|
|
resultsContainer: $searchresults,
|
|
|
|
json: '/search.json',
|
|
|
|
searchResultTemplate: '<a class="search-link" href="{url}" title="{title}">{title}</a>',
|
|
|
|
fuzzy: true
|
|
|
|
})
|
2014-07-03 18:53:39 +02:00
|
|
|
|
2013-12-01 00:47:47 +01:00
|
|
|
// show search
|
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-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() {
|
2014-08-10 00:26:08 +02:00
|
|
|
$searcharea.removeClass('slideDown');
|
2013-12-04 20:54:40 +01:00
|
|
|
$searchpop.addClass('hide');
|
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
|
|
|
|
2013-12-01 00:47:47 +01:00
|
|
|
// hide search area
|
2014-08-10 00:26:08 +02:00
|
|
|
$searcharea.removeClass('slideDown').addClass('bounceOutUp');
|
2013-12-04 20:54:40 +01:00
|
|
|
$searchpop.addClass('hide');
|
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-05-25 22:15:46 +02:00
|
|
|
$thepop = $('.nav-main .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
|
|
|
|
|
|
|
}
|