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: } } }