From 0288bacf5d28e8bf74e5891a7667a032848bf478 Mon Sep 17 00:00:00 2001 From: Prajwalit Date: Fri, 4 Mar 2011 03:30:19 +0530 Subject: [PATCH] Instead of onload focus, added keyboard shortcut '/' to get search bar in focus. --- imdb/imdbac.js | 10 +++++++++- imdb/manifest.json | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/imdb/imdbac.js b/imdb/imdbac.js index 73ec3a2..545732e 100644 --- a/imdb/imdbac.js +++ b/imdb/imdbac.js @@ -75,5 +75,13 @@ }).result(function(event, item) { location.href = "http://www.imdb.com" + item.url; }); - imdbSearch.focus (); + + $ (document).keypress (function (event) { + var et = event.target; + if (event.keyCode === 47 && (et.tagName !== "INPUT" || et.tagName !== "TEXTAREA")) { + event.preventDefault (); + imdbSearch.focus (); + } + }); + }()); diff --git a/imdb/manifest.json b/imdb/manifest.json index a2381f9..2872ee0 100644 --- a/imdb/manifest.json +++ b/imdb/manifest.json @@ -1,6 +1,6 @@ { "name": "IMDB Autocomplete", - "version": "1.2", + "version": "1.3", "description": "Autocomplete for IMDB search bar", "icons": { "128": "icon.jpg" }, "content_scripts": [{