From ca8b0a8ab5631c16b73fdc0691b53872f968f852 Mon Sep 17 00:00:00 2001 From: shaoying Date: Thu, 24 Sep 2020 19:06:56 +0800 Subject: [PATCH] opt some --- frame.js | 27 +++++++++++++++++++++++++++ plugin/local/code/inner.js | 2 +- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/frame.js b/frame.js index 113ebcc8..5d1dd324 100644 --- a/frame.js +++ b/frame.js @@ -627,6 +627,7 @@ Volcanos("onkeypop", {help: "键盘交互", list: [], _init: function(can) { }) }) + document.body.onkeydown = function(event) { if (event.target != document.body) { return } if (can.onkeypop.action && can.onkeypop.action.onimport) { can.onkeypop.action.onimport.keydown(event, can.onkeypop.action, event.key) @@ -634,6 +635,32 @@ Volcanos("onkeypop", {help: "键盘交互", list: [], _init: function(can) { } switch (event.key) { case " ": + break + case "g": + can.page.Select(can, document.body, "fieldset.Action>div.output", function(item) { + item.scrollBy(0, -10000) + }) + break + case "j": + can.page.Select(can, document.body, "fieldset.Action>div.output", function(item) { + item.scrollBy(0, 30) + }) + break + case "f": + can.page.Select(can, document.body, "fieldset.Action>div.output", function(item) { + item.scrollBy(0, 300) + }) + break + case "e": + can.page.Select(can, document.body, "fieldset.Action>div.output", function(item) { + item.scrollBy(0, -30) + }) + break + case "k": + can.page.Select(can, document.body, "fieldset.Action>div.output", function(item) { + item.scrollBy(0, -30) + }) + break default: return } diff --git a/plugin/local/code/inner.js b/plugin/local/code/inner.js index e2248a56..83263795 100644 --- a/plugin/local/code/inner.js +++ b/plugin/local/code/inner.js @@ -287,7 +287,7 @@ Volcanos("onaction", {help: "控件交互", list: [], }) can.page.Select(can, can.ui.tags, "tr", function(item, index) { index == 1 && can.page.Select(can, item, "td", function(item, index) { - index == 0 && item.click() + index == 0 && item.innerText && item.click() }) }) }, true)