This repository has been archived by the owner on Nov 4, 2021. It is now read-only.
forked from BeryJu/dark-vcenter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
inject.js
49 lines (46 loc) · 1.42 KB
/
inject.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// Dark-vCenter JS inject
var injectCss = function (file) {
var style = document.createElement('link');
style.rel = 'stylesheet';
style.type = 'text/css';
style.href = chrome.extension.getURL(file);
(document.head || document.documentElement).appendChild(style);
}
// Check if we're actually in vCenter
// this checks that the 'vSphere Client' span exists
if (document.cookie.includes("VSPHERE-UI-XSRF-TOKEN")) {
var cssFiles = [
'css/clr-ui-dark.css',
'css/fixes.css',
'css/vx-fix.css',
'css/topology-fix.css',
'css/datagrid-fix.css',
'css/dialog-fix.css',
'css/shortcut-fix.css',
'css/task-event-fix.css',
'css/datastore-fix.css',
'css/graph-fix.css',
'css/icon-fix.css',
'css/scrollbar-fix.css',
'css/stack-fix.css',
'css/context-menu-fix.css',
'css/treeview-fix.css',
];
cssFiles.forEach(function (file) {
injectCss(file);
});
}
// Konami Code mechanism
var konamiCode = [38, 38, 40, 40, 37, 39, 37, 39, 66, 65];
var konamiCodePosition = 0;
document.addEventListener('keydown', function (e) {
if (e.keyCode == konamiCode[konamiCodePosition]) {
konamiCodePosition++;
if (konamiCodePosition == konamiCode.length) {
injectCss('css/konami-fix.css');
konamiCodePosition = 0;
}
} else {
konamiCodePosition = 0;
}
});