added EsC key to cancel search

This commit is contained in:
Connor Turland 2014-06-11 19:18:59 -04:00
parent 60e9a85140
commit e67a520a24
2 changed files with 16 additions and 9 deletions

View file

@ -89,9 +89,9 @@ $(document).ready(function () {
});
}
}
var closeSearch = function (closeAfter) {
var closeSearch = function (closeAfter, bypass) {
lT = setTimeout(function () {
if (!sliding1 && searchIsOpen && $('.sidebarSearchField').val() == '') {
if (!sliding1 && searchIsOpen && (bypass || $('.sidebarSearchField').val() == '')) {
sliding1 = true;
$('.sidebarSearchField, .sidebarSearch .tt-hint').css({
padding: '5px 0',
@ -112,7 +112,7 @@ $(document).ready(function () {
$(".sidebarSearch").hover(function () {
openSearch()
}, function () {
closeSearch(800)
closeSearch(800, false)
});
$('.sidebarSearchIcon').click(function (e) {
@ -122,10 +122,11 @@ $(document).ready(function () {
e.stopPropagation();
});
$('body').click(function (e) {
closeSearch(0);
closeSearch(0, false);
});
// if the search is closed and user hits SHIFT+S
// if the search is closed and user hits ctrl+/
// close if they hit ESC
$('body').bind('keydown', function (e) {
switch (e.which) {
case 191:
@ -133,6 +134,11 @@ $(document).ready(function () {
openSearch();
}
break;
case 27:
if (searchIsOpen) {
closeSearch(0, true);
}
break;
default:
break; //console.log(e.which);
}

View file

@ -1,10 +1,8 @@
ISSAD::Application.routes.draw do
resources :in_metacode_sets
resources :metacode_sets, :except => [:show]
resources :metacodes, :except => [:show, :destroy]
root to: 'main#home', via: :get
get '/join', to: redirect('/users/sign_up')
match 'request', to: 'main#requestinvite', via: :get, as: :request
match 'paq', to: 'main#paq', via: :get, as: :paq
@ -18,6 +16,9 @@ ISSAD::Application.routes.draw do
match 'topics/:map_id/:topic_id/removefrommap', to: 'topics#removefrommap', via: :post, as: :removefrommap
match 'synapses/:map_id/:synapse_id/removefrommap', to: 'synapses#removefrommap', via: :post, as: :removefrommap
resources :in_metacode_sets
resources :metacode_sets, :except => [:show]
resources :metacodes, :except => [:show, :destroy]
resources :topics, except: [:index, :new, :edit] do
get :autocomplete_topic, :on => :collection
end