Skip to content
This repository has been archived by the owner on Nov 5, 2019. It is now read-only.

Commit

Permalink
Revert "Fix query string search"
Browse files Browse the repository at this point in the history
This reverts commit f2f4e5b.
  • Loading branch information
ryankirkman committed May 26, 2015
1 parent a80622b commit ceb20fc
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions public/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,16 +114,10 @@
setupMouseEvents();
}

function animateTop() {
$('.container.home').animate({ 'marginTop': '0px' }, 200);
}

var algolia = new AlgoliaSearch('2QWLVLXZB6', '2663c73014d2e4d6d1778cc8ad9fd010', { dsn: true }); // public/search-only credentials
var index = algolia.initIndex('libraries');
var lastQuery;

function searchHandler(ev) {
animateTop();
$('.container.home').animate({ 'marginTop': '0px' }, 200);
// cleanup URL hash if present
location.hash = ''
Expand All @@ -142,12 +136,11 @@
$('#search-box').on('keyup change', searchHandler);

// Perform searches automatically based on the URL hash
if (location.search.length > 1) {
var query = decodeURIComponent(location.search).toLowerCase().match(/q=([^&]+)/);
if (location.hash.length > 1) {
var query = location.hash.match(/q=([\w+]+)/)
if (query) {
query = query[1].replace(/\+/, ' ');
$('#search-box').val(query);
animateTop();
query = query[1].replace(/\+/, ' ')
$('#search-box').val(query)
index.search(query, displayMatchingLibraries, { hitsPerPage: 20 });
}
}
Expand Down

0 comments on commit ceb20fc

Please sign in to comment.