Skip to content
This repository has been archived by the owner on Jan 19, 2021. It is now read-only.

Commit

Permalink
[fix bug 957994] Add key shortcut 's' to the search page.
Browse files Browse the repository at this point in the history
  • Loading branch information
davidgf committed Mar 20, 2014
1 parent e42dc3d commit 84b720c
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions mozillians/static/mozillians/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,20 +50,22 @@ var app = {
$(a).hide().removeAttr("href");

$(window).scroll(function() {
$(this).scrollTop() >= 200 ? $(a).fadeIn("slow") : $(a).fadeOut("slow");
$(this).scrollTop() >= 200 ? $(a).fadeIn("slow") : $(a).fadeOut("slow");
});

$(a).click(function(){
$('html, body').animate({ scrollTop: "0px"}, 1200);
$('html, body').animate({ scrollTop: "0px"}, 1200);
});

$('input, textarea').placeholder();

// Focus search when 's' key is pressed
$('body').keypress(function(event){
if (event.which==115 && !$('input, textarea, select').is(':focus')) {
$('.search-query').focus();
}
});
// Focus search when 's' key is pressed
$('body').keypress(function(event){
if (event.which==115 && !$('input, textarea, select').is(':focus')) {
$searchbox = $('.search-query, #search-form input[type=text]');
$searchbox.focus();
event.preventDefault();
}
});
});
})(jQuery);

0 comments on commit 84b720c

Please sign in to comment.