(function($) { $.fn.simpleJekyllSearch = function(options) { var settings = $.extend({ jsonFile : 'https://willianjusten.github.io/will-jekyll-template/search.json', jsonFormat : 'title,category,desc,url,date,shortdate', template : '
  • {title}
  • ', searchResults : '.search-results', searchResultsTitle : '

    Search Results:

    ', limit : '5', noResults : '

    Oh snap!
    Nothing found! :(

    ' }, options); var properties = settings.jsonFormat.split(','); var jsonData = [], origThis = this, searchResults = $(settings.searchResults); if(settings.jsonFile.length && searchResults.length){ $.ajax({ type: "GET", url: settings.jsonFile, dataType: 'json', success: function(data, textStatus, jqXHR) { jsonData = data; registerEvent(); }, error: function(x,y,z) { console.log("***ERROR in simpleJekyllSearch.js***"); console.log(x); console.log(y); console.log(z); // x.responseText should have what's wrong } }); } function registerEvent(){ origThis.keyup(function(e){ if($(this).val().length){ writeMatches( performSearch($(this).val()) ); }else{ clearSearchResults(); } }); } function performSearch(str){ var matches = []; $.each(jsonData,function(i,entry){ for(var i=0;i