1
0
Fork 0
UserScript/WebIDE/enhance.user.js

31 lines
951 B
JavaScript

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