mirror of
https://github.com/kremalicious/blog.git
synced 2024-11-22 18:00:06 +01:00
fixing the search
what is it with people constantly changing their api option names
This commit is contained in:
parent
fb8ad31e36
commit
9c2c3c49f9
@ -1,5 +1,4 @@
|
|||||||
|
$(ASAP = function() {
|
||||||
$(ASAP = function(){
|
|
||||||
|
|
||||||
siteNavigation.init();
|
siteNavigation.init();
|
||||||
siteEffects.init();
|
siteEffects.init();
|
||||||
@ -7,7 +6,7 @@ $(ASAP = function(){
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$(window).load( AfterLoad = function() {
|
$(window).load(AfterLoad = function() {
|
||||||
|
|
||||||
photoGrid.init();
|
photoGrid.init();
|
||||||
|
|
||||||
@ -23,34 +22,27 @@ var siteNavigation = {
|
|||||||
$searchresults = $('.search-results'),
|
$searchresults = $('.search-results'),
|
||||||
$searchpop = $('.popover');
|
$searchpop = $('.popover');
|
||||||
|
|
||||||
$searchlink.click(function(e){
|
$searchlink.click(function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
SimpleJekyllSearch.init({
|
// init jekyll search
|
||||||
|
SimpleJekyllSearch({
|
||||||
searchInput: $searchfield,
|
searchInput: $searchfield,
|
||||||
resultsContainer: $searchresults,
|
resultsContainer: $searchresults,
|
||||||
dataSource: '/search.json',
|
json: '/search.json',
|
||||||
searchResultTemplate: '<a class="search-link" href="{url}" title="{title}">{title}</a>',
|
searchResultTemplate: '<a class="search-link" href="{url}" title="{title}">{title}</a>',
|
||||||
fuzzy: true
|
fuzzy: true
|
||||||
})
|
})
|
||||||
|
|
||||||
// init jekyll search
|
|
||||||
// $searchfield.jekyllSearch({
|
|
||||||
// searchResults : $searchresults,
|
|
||||||
// searchResultsTitle : '',
|
|
||||||
// template : '<a class="search-link" href="{url}" title="{title}">{title}</a>',
|
|
||||||
// fuzzy : true
|
|
||||||
// });
|
|
||||||
|
|
||||||
// show search
|
// show search
|
||||||
$searcharea.removeClass('ready bounceOutUp').addClass('ready slideDown');
|
$searcharea.removeClass('ready bounceOutUp').addClass('ready slideDown');
|
||||||
$searchfield.focus();
|
$searchfield.focus();
|
||||||
if ( $searchfield.val().length ) {
|
if ($searchfield.val().length) {
|
||||||
$searchpop.removeClass('hide');
|
$searchpop.removeClass('hide');
|
||||||
}
|
}
|
||||||
|
|
||||||
// hide menu too just in case
|
// hide menu too just in case
|
||||||
if ( $('body').hasClass('menu-open') ) {
|
if ($('body').hasClass('menu-open')) {
|
||||||
$('body').removeClass('menu-open');
|
$('body').removeClass('menu-open');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -82,7 +74,7 @@ var siteNavigation = {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// close button
|
// close button
|
||||||
$('.search-close').click(function(e){
|
$('.search-close').click(function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
// hide search area
|
// hide search area
|
||||||
@ -98,13 +90,13 @@ var siteNavigation = {
|
|||||||
var $thelink = $('.menu-btn'),
|
var $thelink = $('.menu-btn'),
|
||||||
$thepop = $('.nav-main .nav-popover');
|
$thepop = $('.nav-main .nav-popover');
|
||||||
|
|
||||||
$thelink.click(function(e){
|
$thelink.click(function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
// toggle menu
|
// toggle menu
|
||||||
$('body').toggleClass('menu-open');
|
$('body').toggleClass('menu-open');
|
||||||
|
|
||||||
if ( $('body').hasClass('menu-open') ) {
|
if ($('body').hasClass('menu-open')) {
|
||||||
$thepop.removeClass('hide');
|
$thepop.removeClass('hide');
|
||||||
} else {
|
} else {
|
||||||
$thepop.addClass('hide');
|
$thepop.addClass('hide');
|
||||||
@ -128,7 +120,7 @@ var siteNavigation = {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
init: function(){
|
init: function() {
|
||||||
this.siteSearch();
|
this.siteSearch();
|
||||||
this.siteMenu();
|
this.siteMenu();
|
||||||
}
|
}
|
||||||
@ -140,17 +132,17 @@ var photoGrid = {
|
|||||||
masonryLayout: function() {
|
masonryLayout: function() {
|
||||||
var $container = $('#main .masonry');
|
var $container = $('#main .masonry');
|
||||||
|
|
||||||
$container.imagesLoaded( function(){
|
$container.imagesLoaded(function() {
|
||||||
$container.masonry({
|
$container.masonry({
|
||||||
itemSelector : 'article',
|
itemSelector: 'article',
|
||||||
columnWidth : '.grid-sizer'
|
columnWidth: '.grid-sizer'
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
init: function(){
|
init: function() {
|
||||||
// only fire when photo page present and screen bigger than 480px
|
// only fire when photo page present and screen bigger than 480px
|
||||||
if ( $('.page-photos').length > 0 ) {
|
if ($('.page-photos').length > 0) {
|
||||||
this.masonryLayout();
|
this.masonryLayout();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -165,7 +157,7 @@ var siteEffects = {
|
|||||||
parent: '.document'
|
parent: '.document'
|
||||||
}
|
}
|
||||||
|
|
||||||
$('.hmedia img').imagesLoaded( function(){
|
$('.hmedia img').imagesLoaded(function() {
|
||||||
$.adaptiveBackground.run(opts)
|
$.adaptiveBackground.run(opts)
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -173,8 +165,8 @@ var siteEffects = {
|
|||||||
$(document).scrollTop($('#main').offset().top);
|
$(document).scrollTop($('#main').offset().top);
|
||||||
},
|
},
|
||||||
|
|
||||||
init: function(){
|
init: function() {
|
||||||
if ( $('.page-single .format-photo').length > 0 ) {
|
if ($('.page-single .format-photo').length > 0) {
|
||||||
this.adaptiveBackground();
|
this.adaptiveBackground();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -185,7 +177,7 @@ var infiniteScroll = {
|
|||||||
|
|
||||||
infiniteScrollSetup: function() {
|
infiniteScrollSetup: function() {
|
||||||
|
|
||||||
if ( $('.page-photos').length > 0 ) {
|
if ($('.page-photos').length > 0) {
|
||||||
var items = '#main .masonry';
|
var items = '#main .masonry';
|
||||||
} else {
|
} else {
|
||||||
var items = '#main article.hentry';
|
var items = '#main article.hentry';
|
||||||
@ -196,11 +188,11 @@ var infiniteScroll = {
|
|||||||
loading: {
|
loading: {
|
||||||
img: ''
|
img: ''
|
||||||
},
|
},
|
||||||
itemSelector : items,
|
itemSelector: items,
|
||||||
nextSelector : '.next a',
|
nextSelector: '.next a',
|
||||||
navSelector : '.paginator',
|
navSelector: '.paginator',
|
||||||
binder : $scrollContent,
|
binder: $scrollContent,
|
||||||
behavior : 'krlc3',
|
behavior: 'krlc3',
|
||||||
}, function($scrollContent) {
|
}, function($scrollContent) {
|
||||||
// run picturefill over retrieved items
|
// run picturefill over retrieved items
|
||||||
picturefill();
|
picturefill();
|
||||||
@ -210,7 +202,7 @@ var infiniteScroll = {
|
|||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
init: function(){
|
init: function() {
|
||||||
this.infiniteScrollSetup();
|
this.infiniteScrollSetup();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -224,9 +216,9 @@ var infiniteScroll = {
|
|||||||
Usage: behavior: 'krlc3'
|
Usage: behavior: 'krlc3'
|
||||||
--------------------------------
|
--------------------------------
|
||||||
*/
|
*/
|
||||||
$.extend($.infinitescroll.prototype,{
|
$.extend($.infinitescroll.prototype, {
|
||||||
|
|
||||||
_setup_krlc3: function infscr_setup_krlc3 () {
|
_setup_krlc3: function infscr_setup_krlc3() {
|
||||||
var opts = this.options,
|
var opts = this.options,
|
||||||
instance = this,
|
instance = this,
|
||||||
loader = $('<span class="loading"> ...</span>');
|
loader = $('<span class="loading"> ...</span>');
|
||||||
@ -242,10 +234,10 @@ $.extend($.infinitescroll.prototype,{
|
|||||||
});
|
});
|
||||||
|
|
||||||
// custom start
|
// custom start
|
||||||
instance.options.loading.start = function (opts) {
|
instance.options.loading.start = function(opts) {
|
||||||
loader
|
loader
|
||||||
.appendTo(opts.nextSelector)
|
.appendTo(opts.nextSelector)
|
||||||
.show(opts.loading.speed, function () {
|
.show(opts.loading.speed, function() {
|
||||||
instance.beginAjax(opts);
|
instance.beginAjax(opts);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
---
|
---
|
||||||
|
layout: null
|
||||||
---
|
---
|
||||||
[
|
[
|
||||||
{% for post in site.posts %}
|
{% for post in site.posts %}
|
||||||
|
Loading…
Reference in New Issue
Block a user