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