更新 'WebIDE/enhance.user.js'

This commit is contained in:
502647092 2018-05-15 18:08:39 +08:00
parent 20012c5d6f
commit 3007db60da

View File

@ -1,7 +1,7 @@
// ==UserScript== // ==UserScript==
// @name WebIDE增强脚本 // @name WebIDE增强脚本
// @namespace http://ide.yumc.pw/ // @namespace http://ide.yumc.pw/
// @version 0.4 // @version 0.5
// @description Coding WebIDE 增强脚本 // @description Coding WebIDE 增强脚本
// @author MiaoWoo // @author MiaoWoo
// @match http*://ide.yumc.pw/ws/* // @match http*://ide.yumc.pw/ws/*
@ -20,10 +20,31 @@
}, 300) }, 300)
document.onkeydown = function() { document.onkeydown = function() {
var e = window.event; var e = window.event;
if (e.keyCode == 87 && e.altKey) { if (e.altKey) {
var activeTab = document.getElementsByClassName('tab-label active')[0]; switch (e.keyCode) {
if (activeTab) { case 87:
activeTab.childNodes[2].childNodes[0].click(); // 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:
} }
} }
} }