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