From 8c4982f6acb9192d15205ba3b15a25843b9dec93 Mon Sep 17 00:00:00 2001 From: WayneXuan Date: Mon, 11 Jan 2016 14:07:36 +0800 Subject: [PATCH] =?UTF-8?q?popup=20Alt+Enter=20=E6=B8=85=E7=A9=BA=E5=B9=B6?= =?UTF-8?q?=E8=81=9A=E7=84=A6$input?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/javascript/popup.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/javascript/popup.js b/src/javascript/popup.js index 101e528..94d7607 100644 --- a/src/javascript/popup.js +++ b/src/javascript/popup.js @@ -395,9 +395,11 @@ toggleKey.onchange = function (event) { // updateSetting("duration", event.target.value); // }) -//在popup页内 Enter键 查询选中部分 如果没有选中部分,$input请求焦点 +/** + * popup页 快捷键绑定 + */ document.addEventListener('keyup',function(e){ - if(document.activeElement.tagName=="BODY" && e.which==13){ + if(document.activeElement.tagName=="BODY" && e.which==13){ //Enter 查询选中部分 如果没有选中部分,$input请求焦点 var selection=window.getSelection().toString(); if(selection.length>0) { $historyList.innerHTML = ""; @@ -405,6 +407,9 @@ document.addEventListener('keyup',function(e){ }else{ $input.focus(); } + }else if(e.which==18){ //Alt+Enter $input清空内容并请求焦点 + $input.value = ''; + $input.focus(); } });