From bd57bb2acaf8f71cc5e7dbb756bb0e1651ba81cd Mon Sep 17 00:00:00 2001 From: penghaifeng Date: Mon, 1 Apr 2019 18:22:47 +0800 Subject: [PATCH] =?UTF-8?q?=E6=90=9C=E7=B4=A2=E6=94=AF=E6=8C=81=E7=9B=B4?= =?UTF-8?q?=E6=8E=A5=E7=B2=98=E8=B4=B4=EF=BC=9B=E4=BC=98=E5=8C=96=E6=80=A7?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/index.css | 4 ++++ src/index.js | 17 ++++++----------- src/manifest.json | 2 +- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/index.css b/src/index.css index b457481..79d943a 100644 --- a/src/index.css +++ b/src/index.css @@ -159,4 +159,8 @@ body { padding: 0.5rem 1rem; font-style: italic; cursor: pointer; +} + +.suggestions-ctn li span:hover { + text-decoration: underline; } \ No newline at end of file diff --git a/src/index.js b/src/index.js index f0da31b..fb1491e 100644 --- a/src/index.js +++ b/src/index.js @@ -153,6 +153,12 @@ function initSearch(){ suggestionsCtn.innerHTML = ''; } } + $('body').onkeydown = function(e){ + if(e.keyCode == 17 || e.keyCode == 91 || e.keyCode == 93){ + //Control or Command + searchInput.focus(); + } + } $('body').onkeypress = function(e){ searchInput.focus(); } @@ -201,20 +207,9 @@ function onSuggestionReceived(r){ suggestionsCtn.innerHTML = suggestionsHtml; $$('.suggestions-ctn li span').forEach(function(v, i){ v.onclick = function(){doSearch(this.innerText)}; - v.onmouseover = function(){searchItemHover(this)}; - v.onmouseout = function(){searchItemMouseout(this)}; }); } } -function searchItemHover(item){ - if(currentSelectSuggestionIndex >= 0 && currentSelectSuggestionIndex < suggestionsCtn.childNodes.length){ - suggestionsCtn.childNodes[currentSelectSuggestionIndex].childNodes[0].classList.remove('clear-box-shadow'); - } - item.classList.add('clear-box-shadow'); -}; -function searchItemMouseout(item){ - item.classList.remove('clear-box-shadow'); -}; function doSearch(keyword){ window.location.href = SearchEngines[Settings.searchEngine].replace('{keyword}', keyword); } diff --git a/src/manifest.json b/src/manifest.json index 583316f..318500e 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -2,7 +2,7 @@ "manifest_version": 2, "name": "__MSG_pluginName__", "short_name": "__MSG_shortName__", - "version": "1.0.5", + "version": "1.0.6", "description": "__MSG_pluginDesc__", "icons": {