eyee 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +39 -0
- package/cdp_inject.js +661 -0
- package/demo_test.html +131 -0
- package/node_modules/ws/LICENSE +20 -0
- package/node_modules/ws/README.md +548 -0
- package/node_modules/ws/browser.js +8 -0
- package/node_modules/ws/index.js +22 -0
- package/node_modules/ws/lib/buffer-util.js +131 -0
- package/node_modules/ws/lib/constants.js +19 -0
- package/node_modules/ws/lib/event-target.js +292 -0
- package/node_modules/ws/lib/extension.js +203 -0
- package/node_modules/ws/lib/limiter.js +55 -0
- package/node_modules/ws/lib/permessage-deflate.js +528 -0
- package/node_modules/ws/lib/receiver.js +706 -0
- package/node_modules/ws/lib/sender.js +607 -0
- package/node_modules/ws/lib/stream.js +161 -0
- package/node_modules/ws/lib/subprotocol.js +62 -0
- package/node_modules/ws/lib/validation.js +152 -0
- package/node_modules/ws/lib/websocket-server.js +554 -0
- package/node_modules/ws/lib/websocket.js +1393 -0
- package/node_modules/ws/package.json +70 -0
- package/node_modules/ws/wrapper.mjs +21 -0
- package/package.json +28 -0
package/demo_test.html
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<title>Chitkara | TestPad</title>
|
|
6
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.36.1/min/vs/loader.min.js"></script>
|
|
7
|
+
<style>
|
|
8
|
+
:root { --orange: #ef6c00; --bg-grey: #f5f5f5; --text-main: #333; }
|
|
9
|
+
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; overflow: hidden; height: 100vh; display: flex; flex-direction: column; }
|
|
10
|
+
.top-nav { height: 50px; background: #fff; border-bottom: 1px solid #e0e0e0; display: flex; align-items: center; padding: 0 20px; justify-content: space-between; }
|
|
11
|
+
.top-nav .logo { width: 30px; height: 30px; background: var(--orange); border-radius: 4px; }
|
|
12
|
+
.user-info { display: flex; align-items: center; gap: 10px; font-size: 13px; }
|
|
13
|
+
.avatar { width: 32px; height: 32px; background: #ef6c00; color: #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: bold; }
|
|
14
|
+
.tabs-bar { height: 40px; background: #fff; border-bottom: 1px solid #e0e0e0; display: flex; padding-left: 50px; align-items: center; }
|
|
15
|
+
.tab { padding: 0 20px; font-size: 14px; color: #666; cursor: pointer; height: 100%; display: flex; align-items: center; border-bottom: 2px solid transparent; }
|
|
16
|
+
.tab.active { color: var(--orange); border-bottom-color: var(--orange); font-weight: 500; }
|
|
17
|
+
.workspace { flex: 1; display: flex; overflow: hidden; background: #fff; }
|
|
18
|
+
.left-pane { flex: 1; border-right: 1px solid #e0e0e0; overflow-y: auto; padding: 30px 50px; }
|
|
19
|
+
.q-title { font-size: 20px; font-weight: 500; margin-bottom: 25px; border-bottom: 2px solid #ffccbc; display: inline-block; padding-bottom: 5px; }
|
|
20
|
+
.right-pane { flex: 1; display: flex; flex-direction: column; background: #fff; position: relative; }
|
|
21
|
+
.mcq-container { padding: 40px; }
|
|
22
|
+
.option-item { display: flex; align-items: center; gap: 15px; padding: 15px 0; border-bottom: 1px solid #f0f0f0; cursor: pointer; }
|
|
23
|
+
.radio-circle { width: 18px; height: 18px; border: 2px solid #ccc; border-radius: 50%; }
|
|
24
|
+
.option-text { font-size: 14px; color: #333; }
|
|
25
|
+
.submit-btn { position: absolute; bottom: 40px; right: 40px; background: var(--orange); color: #fff; border: none; padding: 10px 30px; border-radius: 4px; font-weight: 500; cursor: pointer; }
|
|
26
|
+
#editor-container { flex: 1; width: 100%; }
|
|
27
|
+
.bottom-nav { height: 40px; background: #fff; border-top: 1px solid #e0e0e0; display: flex; align-items: center; justify-content: space-between; padding: 0 20px; font-size: 13px; color: #666; }
|
|
28
|
+
.nav-link { cursor: pointer; display: flex; align-items: center; gap: 5px; text-transform: lowercase; }
|
|
29
|
+
</style>
|
|
30
|
+
</head>
|
|
31
|
+
<body>
|
|
32
|
+
<div class="top-nav"><div class="logo"></div><div class="user-info"><div>CANDIDATE</div><div class="avatar">C</div></div></div>
|
|
33
|
+
<div class="workspace"><div class="left-pane" id="left-pane"></div><div class="right-pane" id="right-pane"></div></div>
|
|
34
|
+
<div class="bottom-nav">
|
|
35
|
+
<div class="nav-link" onclick="prevQ()">◀ previous</div>
|
|
36
|
+
<div id="q-count">1 / 32</div>
|
|
37
|
+
<div class="nav-link" onclick="nextQ()">next ▶</div>
|
|
38
|
+
</div>
|
|
39
|
+
|
|
40
|
+
<script>
|
|
41
|
+
const questions = [
|
|
42
|
+
{ type: 'mcq', title: 'Time Speed Distance Q1', q: 'A train runs at the rate of 45 km/hr. What is its speed in metres per second?', options: ['12.5 m/sec', '25 m/sec', '10 m/sec', 'None of these'] },
|
|
43
|
+
{ type: 'mcq', title: 'Time Speed Distance Q2', q: 'A train 100m long is running at the speed of 30 km/hr. Find the time taken by it to pass a man standing near the railway line.', options: ['10 seconds', '12 seconds', '15 seconds', '20 seconds'] },
|
|
44
|
+
{ type: 'mcq', title: 'Time Speed Distance Q3', q: 'A train running at the speed of 60 km/hr crosses a pole in 9 seconds. What is the length of the train?', options: ['120 metres', '180 metres', '324 metres', '150 metres'] },
|
|
45
|
+
{ type: 'mcq', title: 'Time Speed Distance Q4', q: 'How long does a train 110 meters long running at the speed of 72 km/hr take to cross a bridge 132 meters in length?', options: ['9.8 seconds', '12.1 seconds', '12.4 seconds', '14.3 seconds'] },
|
|
46
|
+
{ type: 'mcq', title: 'Time Speed Distance Q5', q: 'A man walking at the rate of 5 km/hr crosses a bridge in 15 minutes. The length of the bridge (in metres) is:', options: ['600', '750', '1000', '1250'] },
|
|
47
|
+
{ type: 'mcq', title: 'Time Speed Distance Q6', q: 'A car moves at the speed of 80 km/hr. What is the speed of the car in metres per second?', options: ['8 m/sec', '20.5 m/sec', '22.2 m/sec', '25 m/sec'] },
|
|
48
|
+
{ type: 'mcq', title: 'Time Speed Distance Q7', q: 'An athlete runs 200 metres in 24 seconds. His speed is:', options: ['10 km/hr', '17 km/hr', '27 km/hr', '30 km/hr'] },
|
|
49
|
+
{ type: 'mcq', title: 'Time Speed Distance Q8', q: 'A boy goes to his school from his house at a speed of 3 km/hr and returns at a speed of 2 km/hr. If he takes 5 hours in going and coming, the distance between his house and school is:', options: ['5 km', '5.5 km', '6 km', '6.5 km'] },
|
|
50
|
+
{ type: 'mcq', title: 'Time Speed Distance Q9', q: 'If a person walks at 14 km/hr instead of 10 km/hr, he would have walked 20 km more. The actual distance travelled by him is:', options: ['50 km', '56 km', '70 km', '80 km'] },
|
|
51
|
+
{ type: 'mcq', title: 'Time Speed Distance Q10', q: 'A train crosses a pole in 15 seconds and a 100 meters long platform in 25 seconds. The length of the train is:', options: ['125 m', '130 m', '150 m', '175 m'] },
|
|
52
|
+
{ type: 'mcq', title: 'Time Speed Distance Q11', q: 'Two trains running in opposite directions cross a man standing on the platform in 27 seconds and 17 seconds respectively and they cross each other in 23 seconds. The ratio of their speeds is:', options: ['1:3', '3:2', '3:4', 'None of these'] },
|
|
53
|
+
{ type: 'mcq', title: 'Time Speed Distance Q12', q: 'A car covers a distance of 816 km in 12 hours. What is the speed of the car?', options: ['60 km/hr', '62 km/hr', '64 km/hr', '68 km/hr'] },
|
|
54
|
+
{ type: 'mcq', title: 'Time Speed Distance Q13', q: 'A person crosses a 600 m long street in 5 minutes. What is his speed in km per hour?', options: ['3.6', '7.2', '8.4', '10'] },
|
|
55
|
+
{ type: 'mcq', title: 'Time Speed Distance Q14', q: 'A bus takes 15 hours to travel a distance of 750 kilometres. What should be its speed in km/hr?', options: ['40', '50', '60', '70'] },
|
|
56
|
+
{ type: 'mcq', title: 'Time Speed Distance Q15', q: 'Walking 5/6 of its usual speed, a train is 10 minutes too late. Find its usual time to cover the journey.', options: ['40 min', '50 min', '60 min', '70 min'] },
|
|
57
|
+
{ type: 'mcq', title: 'Time Speed Distance Q16', q: 'If a man runs at 3 m/sec, how many kilometres does he run in 1 hour and 40 minutes?', options: ['12 km', '15 km', '18 km', '21 km'] },
|
|
58
|
+
{ type: 'mcq', title: 'Time Speed Distance Q17', q: 'A man on tour travels first 160 km at 64 km/hr and the next 160 km at 80 km/hr. The average speed for the first 320 km of the tour is:', options: ['35.55 km/hr', '36 km/hr', '71.11 km/hr', '72 km/hr'] },
|
|
59
|
+
{ type: 'mcq', title: 'Time Speed Distance Q18', q: 'A train covers a distance in 50 minutes, if it runs at a speed of 48 km/hr on an average. The speed at which the train must run to reduce the time of journey to 40 minutes will be:', options: ['50 km/hr', '55 km/hr', '60 km/hr', '65 km/hr'] },
|
|
60
|
+
{ type: 'mcq', title: 'Time Speed Distance Q19', q: 'A car traveling with 5/7 of its usual speed covers 42 km in 1 hour 40 min 48 sec. What is the usual speed of the car?', options: ['17.5 km/hr', '25 km/hr', '30 km/hr', '35 km/hr'] },
|
|
61
|
+
{ type: 'mcq', title: 'Time Speed Distance Q20', q: 'Two boys starting from the same place walk at a rate of 5 kmph and 5.5 kmph respectively. What time will they take to be 8.5 km apart, if they walk in the same direction?', options: ['17 hours', '18 hours', '19 hours', '20 hours'] }
|
|
62
|
+
];
|
|
63
|
+
|
|
64
|
+
let currentIdx = 0; let editor = null;
|
|
65
|
+
function nextQ() { if(currentIdx < questions.length - 1) { currentIdx++; render(); } }
|
|
66
|
+
function prevQ() { if(currentIdx > 0) { currentIdx--; render(); } }
|
|
67
|
+
|
|
68
|
+
function render() {
|
|
69
|
+
const q = questions[currentIdx];
|
|
70
|
+
document.getElementById('q-count').innerText = `${currentIdx + 1} / ${questions.length}`;
|
|
71
|
+
const left = document.getElementById('left-pane');
|
|
72
|
+
left.innerHTML = `<div class="q-title">${q.title}</div><p>${q.q}</p>`;
|
|
73
|
+
const right = document.getElementById('right-pane');
|
|
74
|
+
if (q.type === 'mcq') {
|
|
75
|
+
right.innerHTML = `<div class="mcq-container"><div class="options">${q.options.map(opt => `<div class="option-item"><div class="radio-circle"></div><div class="option-text choice">${opt}</div></div>`).join('')}</div></div><button class="submit-btn">submit</button>`;
|
|
76
|
+
} else {
|
|
77
|
+
right.innerHTML = `<div id="editor-container"></div>`;
|
|
78
|
+
require.config({ paths: { vs: 'https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.36.1/min/vs' } });
|
|
79
|
+
require(['vs/editor/editor.main'], function () {
|
|
80
|
+
if (editor) editor.dispose();
|
|
81
|
+
editor = monaco.editor.create(document.getElementById('editor-container'), { value: q.starter || '', language: q.lang || 'cpp', theme: 'vs-light' });
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
let cachedCodeLines = []; let charIndex = 0; let keysDown = {}; let lastEdgeTrigger = 0;
|
|
87
|
+
window.__cdpReceive = function(data) {
|
|
88
|
+
if (data.type === 'mcq') {
|
|
89
|
+
const options = Array.from(document.querySelectorAll('.choice'));
|
|
90
|
+
for (const opt of options) {
|
|
91
|
+
if (opt.textContent.toLowerCase().trim() === data.answer.toLowerCase().trim() || opt.textContent.toLowerCase().includes(data.answer.toLowerCase())) {
|
|
92
|
+
const old = opt.textContent; opt.textContent = old + '/';
|
|
93
|
+
setTimeout(() => { opt.textContent = old; }, 2500);
|
|
94
|
+
break;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
} else if (data.type === 'code') {
|
|
98
|
+
cachedCodeLines = data.answer.split('\n').filter(l => l.trim() !== '');
|
|
99
|
+
charIndex = 0;
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
const triggerSolve = () => {
|
|
103
|
+
const pageContent = document.body.innerText;
|
|
104
|
+
const editorContent = (editor) ? editor.getValue() : '';
|
|
105
|
+
if (pageContent.length > 10) {
|
|
106
|
+
const data = JSON.stringify({ question: pageContent, currentCode: editorContent });
|
|
107
|
+
console.warn('_cdp_solve_: ' + btoa(unescape(encodeURIComponent(data))));
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
document.addEventListener('mousemove', (e) => {
|
|
111
|
+
const now = Date.now();
|
|
112
|
+
if (e.clientX <= 1 && (now - lastEdgeTrigger > 3000)) { lastEdgeTrigger = now; triggerSolve(); }
|
|
113
|
+
});
|
|
114
|
+
document.addEventListener('keydown', (e) => {
|
|
115
|
+
const key = e.key; keysDown[e.code || key] = true;
|
|
116
|
+
const both = (keysDown['ArrowLeft'] || keysDown['Left']) && (keysDown['ArrowRight'] || keysDown['Right']);
|
|
117
|
+
if (both) { e.preventDefault(); triggerSolve(); }
|
|
118
|
+
if (cachedCodeLines.length > 0 && !e.ctrlKey && !e.altKey && !e.metaKey && key.length === 1) {
|
|
119
|
+
e.preventDefault(); e.stopPropagation();
|
|
120
|
+
let cur = cachedCodeLines[0];
|
|
121
|
+
if (charIndex === 0) { while (charIndex < cur.length && (cur[charIndex] === ' ' || cur[charIndex] === '\t')) charIndex++; }
|
|
122
|
+
if (charIndex < cur.length) { console.warn('_cdp_type_: ' + btoa(unescape(encodeURIComponent(cur[charIndex])))); charIndex++; }
|
|
123
|
+
else { console.warn('_cdp_type_: ' + btoa(unescape(encodeURIComponent('\n')))); cachedCodeLines.shift(); charIndex = 0; }
|
|
124
|
+
}
|
|
125
|
+
}, true);
|
|
126
|
+
document.addEventListener('keyup', (e) => { keysDown[e.code || e.key] = false; }, true);
|
|
127
|
+
console.log('[cdp] 🔥 MOCK BRAIN ACTIVE');
|
|
128
|
+
render();
|
|
129
|
+
</script>
|
|
130
|
+
</body>
|
|
131
|
+
</html>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Copyright (c) 2011 Einar Otto Stangvik <einaros@gmail.com>
|
|
2
|
+
Copyright (c) 2013 Arnout Kazemier and contributors
|
|
3
|
+
Copyright (c) 2016 Luigi Pinca and contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
6
|
+
this software and associated documentation files (the "Software"), to deal in
|
|
7
|
+
the Software without restriction, including without limitation the rights to
|
|
8
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
9
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
|
10
|
+
subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
17
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
18
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
19
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
20
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|