修复无图标标签页无法关闭的问题

This commit is contained in:
502647092 2018-07-02 15:48:58 +08:00
parent 655f3cd70c
commit f077826b95

View File

@ -1,7 +1,7 @@
// ==UserScript==
// @name WebIDE增强脚本
// @namespace http://ide.yumc.pw/
// @version 0.8
// @version 0.8.1
// @description Coding WebIDE 增强脚本
// @author MiaoWoo
// @match http*://ide.yumc.pw/ws/*
@ -58,8 +58,6 @@
if (keyMap.type === "menu") { document.getElementById(keyMap.menu).click(); }
var item = document.getElementsByClassName(keyMap.class)[0];
if (item) { item.click() }
} else {
console.log(key);
}
}
document.onkeydown = function() {
@ -69,8 +67,9 @@
case 87:
// Alt + W 关闭Tab标签页
var activeTab = document.getElementsByClassName('tab-label active')[0];
if (activeTab && activeTab.childNodes[2]) {
activeTab.childNodes[2].childNodes[0].click();
if (activeTab) {
var nodes = activeTab.childNodes;
nodes[nodes.length - 1].childNodes[0].click();
}
break;
case 81: