From 3007db60da8293372e9f394064e77128971156de Mon Sep 17 00:00:00 2001 From: 502647092 Date: Tue, 15 May 2018 18:08:39 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20'WebIDE/enhance.user.js'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WebIDE/enhance.user.js | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/WebIDE/enhance.user.js b/WebIDE/enhance.user.js index f54b3a8..fd7fa81 100644 --- a/WebIDE/enhance.user.js +++ b/WebIDE/enhance.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name WebIDE增强脚本 // @namespace http://ide.yumc.pw/ -// @version 0.4 +// @version 0.5 // @description Coding WebIDE 增强脚本 // @author MiaoWoo // @match http*://ide.yumc.pw/ws/* @@ -20,10 +20,31 @@ }, 300) document.onkeydown = function() { var e = window.event; - if (e.keyCode == 87 && e.altKey) { - var activeTab = document.getElementsByClassName('tab-label active')[0]; - if (activeTab) { - activeTab.childNodes[2].childNodes[0].click(); + if (e.altKey) { + switch (e.keyCode) { + case 87: + // Alt + W 关闭Tab标签页 + var activeTab = document.getElementsByClassName('tab-label active')[0]; + if (activeTab) { + activeTab.childNodes[2].childNodes[0].click(); + } + break; + case 81: + // Alt + Q 切换Tab标签页 + var currectTab = document.getElementsByClassName('tab-label active')[0]; + if (currectTab) { + var tab; + if (currectTab.nextElementSibling) { + tab = currectTab.nextElementSibling; + } else { + tab = document.getElementsByClassName('tab-label')[0]; + } + if (tab) { + tab.click(); + } + } + break; + default: } } }