更新 'WebIDE/enhance.user.js'

This commit is contained in:
502647092 2018-05-15 17:49:59 +08:00
parent fb1604d30a
commit 0e49b26996

View File

@ -1,7 +1,7 @@
// ==UserScript==
// @name WebIDE增强脚本
// @namespace http://ide.yumc.pw/
// @version 0.3
// @version 0.4
// @description Coding WebIDE 增强脚本
// @author MiaoWoo
// @match http*://ide.yumc.pw/ws/*
@ -13,14 +13,14 @@
'use strict';
var id = setInterval(function (){
if (document.getElementsByClassName('ide-container')[0]) {
window.onbeforeunload = function () { return false; }
document.onbeforeunload = function () { return false; }
console.log('已阻止 Ctrl + W 关闭页面...')
clearInterval(id);
}
}, 300)
document.onkeydown = function() {
var oEvent = window.event;
if (oEvent.keyCode == 87 && oEvent.altKey) {
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();