.row .col-xs-12.col-sm-3 span a.btn.btn-primary.btn-big.btn-block.btn-responsive(href='/stories/submit' class="#{ page === 'hot' ? '' : 'hidden' }") Submit span a.btn.btn-success.btn-big.btn-block.btn-responsive(href='/news/' class="#{ (page !== 'hot') ? '' : 'hidden' }") All .visible-xs .button-spacer .col-xs-12.col-sm-9 .input-group input#searchArea.big-text-field.field-responsive.form-control(type='text', placeholder='Search our links') span.input-group-btn button#searchbutton.btn.btn-big.btn-primary.btn-responsive(type='button') Search .spacer .row .col-xs-12.col-sm-8.col-sm-offset-2.well h4.text-center Submit your favorite   a(href='http://imgs.xkcd.com/comics/wisdom_of_the_ancients.png') profound comic about coding |   to Camper News. p.text-center Start the headline with: "Deep Code Comic:" then add a clever description that doesn't ruin the punchline. We'll publish the top 25 comics (and the campers who submitted them) in Wednesday's blog post. You'll also get 1 point for every upvote. .spacer #search-results .spacer #story-list ul#stories script. $('#searchArea').keypress(function (event) { if (event.keyCode === 13 || event.which === 13) { executeSearch(); $('#searchArea').focus(); event.preventDefault(); } }); $('#searchbutton').on('click', function () { executeSearch(); }); function executeSearch() { $('#stories').empty(); var searchTerm = $('#searchArea').val(); var getLinkedName = function getLinkedName(name) { return name.toLowerCase().replace(/\s/g, '-'); } $.post('/stories/search', { data: { searchValue: searchTerm } }) .fail(function (xhr, textStatus, errorThrown) { $('#search-results').empty(); var div = document.createElement("div"); $(div).html("

No Results Found

"); $(div).appendTo($('#search-results')); }) .done(function (data, textStatus, xhr) { $('#search-results').empty(); for (var i = 0; i < data.length; i++) { var div = document.createElement('div'); var linkedName = getLinkedName(data[i].storyLink); var rank = data[i].rank; $(div).html( "
" + "
" + "" + "" + "" + "
" + "
" + "" + data[i].headline + "" + "
" + "
" + "
" + rank + (rank > 1 ? " points" : " point") + " · posted " + moment(data[i].timePosted).fromNow() + " by " + "@" + data[i].author.username + " " + "
" + "
" + "
" + "discuss" + "
" + "
" + "
" + "") $(div).addClass('story-list news-box-search') $(div).appendTo($('#search-results')); } var hr = document.createElement("div"); $(hr).html("

End search results

") $(hr).appendTo($('#search-results')); }); }