This repository was archived by the owner on Feb 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathos.html
More file actions
259 lines (252 loc) · 9.03 KB
/
os.html
File metadata and controls
259 lines (252 loc) · 9.03 KB
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
<!-- QUICK NOTE: Sorry for all the other spaghetti code, they were put in as reference and will be improved in a later update of this file. -->
<!DOCTYPE html>
<html onerror="failboot();">
<head>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<script onerror="failboot();">window.$ = window.jQuery = require('jquery');</script>
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="saxos.css">
</head>
<body onerror="failboot();">
<div id="startm" class="modal">
<div class="modal-content">
<span class="close"></span>
<h1>SaxOS Whitedragon | <span id="menutime"></span></h1>
</div>
</div>
<script src="login.js"></script>
<text id="license" class="license"></text>
<div id="context-menu">
<div class="item" style ="border-top-right-radius: 10px; border-top-left-radius: 10px;" onclick="shutdownos()">Shutdown </div>
<div class="item" onclick="restartos()">Restart </div>
<div class="item" onclick="buildSettings()">Settings </div>
<div class="item" onclick="buildTerminal()">Terminal </div>
<div class="item" onclick="buildTetris()">Tetris </div>
<div class="item" style ="border-bottom-right-radius: 10px; border-bottom-left-radius: 10px;" onclick="signout()">Sign Out </div>
</div>
<script src="terminalbuilder.js"></script>
<script src="rightclickmenu.js"></script>
<div id="settings" class="window" style="background-color: rgba(255,255,255,1);">
<div id="wintitlebar">Settings<span class="closebutton" onclick="delSettings()"></span></div>
<h1>Settings is currently unavailable.</h1>
</div>
<div id="terminal" class="window">
<div id="wintitlebar">Terminal<span class="closebutton" onclick="delTerminal()"></span></div>
<iframe src="./terminal.html" width="900" height="666"></iframe>
</div>
<div id="tetris" class="window">
<div id="wintitlebar">Tetris<span class="closebutton" onclick="delTetris()"></span></div>
<iframe id="tetrisgame" src="./tetris.html" width="325" height="644"></iframe>
</div>
<div class="header" id="hb"></div>
<div class="footer" id="tb">
<button id="startmenu" class="snap-left dfbutton" style="border-bottom-left-radius: 10px; border-top-left-radius: 10px;">Menu</button>
<span id="time" class="snap-rite taskb" style="border-bottom-right-radius: 10px; border-top-right-radius: 10px;"></span>
<button id="settings" class="dfbutton" onclick="buildSettings()">Settings</button>
<button id="tetris2" class="dfbutton" onclick="buildTetris()">Tetris</button>
<button id="terminal4" class="dfbutton" onclick="buildTerminal()">Terminal</button>
<span id="user" class="userfield taskb">demo</span>
</div>
<div id="taskbaractivate" class="taskbaractivate"></div>
<script onerror="failboot();">
var taskbaract = document.getElementById("taskbaractivate");
var taskbar = document.getElementById("tb");
taskbaract.onclick = function(){
$("#taskbaractivate").fadeOut(500);
setTimeout(()=>{
$(".footer").css('bottom', "-5px");
}, 450)
}
taskbar.ondblclick = function(){
$(".footer").css('bottom', "-55px");
setTimeout(()=>{
$("#taskbaractivate").fadeIn(500);
}, 750)
}
// Connectivity check script
function checkInternet() {
/*require('dns').lookupService('8.8.8.8', 53, function(err, hostname, service){
if(err){
document.getElementById("internet").innerHTML = "❌";
} else{document.getElementById("internet").innerHTML = "🖧";}
});*/
}
var modal = document.getElementById("startm");
var btn = document.getElementById("startmenu");
var span = document.getElementsByClassName("close")[0];
btn.onclick = function(){
modal.style.display = "block";
if ($('.modal').css('opacity') !== "1"){ return; }else{
$('.modal').fadeOut(1000);
setTimeout(function(){
$('.modal').css("display", "none");
console.log("start menu despawned")
}, 1250)
}
}
setInterval(()=>{
if(window.getComputedStyle(taskbar).bottom == "-5px" && window.getComputedStyle(taskbar).opacity == "1"){
$("#taskbaractivate").css('display', 'none')
} else return;
},500)
window.onkeydown = function(e) {
if (document.location.pathname === srdir+"os.html"){
var xs = e || window.event;
switch(xs.which){
case 17:
case 9:
e.preventDefault()
if (e.repeat) return;
if (e.location == 1) {
modal.style.display = "block";
if ($('.modal').css('opacity') !== "1"){ return; }else{
$('.modal').fadeOut(1000);
setTimeout(function(){
$('.modal').css("display", "none");
console.log("start menu despawned")
}, 1250)
}
} else
if (e.location == 2 || e.location == 0) {
$("#taskbaractivate").fadeOut(500);
if(window.getComputedStyle(taskbar).bottom == "-5px") { // if dock is already in visible mode set it to hidden mode
$(".footer").css('bottom', "-75px");
setTimeout(()=>{
$("#taskbaractivate").fadeIn(500);
}, 600)
} else // vice versa, if dock is already in hidden mode set it to visible mode
setTimeout(()=>{
$("#taskbaractivate").css('display', 'none')
$(".footer").css('bottom', "-5px");
$("#taskbaractivate").css('display', 'none')
}, 450)
} else return;
break;
}
} else return console.log("agent not os")
}
function unlock () {
locked = false;
}
$('.close').on('click', function() {
$('.modal').fadeOut(1000);
setTimeout(function(){
$('.modal').css("display", "none");
console.log("start menu despawned")
}, 1250)
});
// When you click outside start menu bounds despawn it.
window.onclick = function(event) {
if (event.target == modal) {
$('.modal').fadeOut(1000);
setTimeout(function(){
$('.modal').css("display", "none");
console.log("start menu despawned")
}, 1250)
}
}
function addZero() {
if (i < 10) {
i = "0" + i;
}
return i;
}
function addZero(i) {
if (i < 10) {
i = "0" + i;
}
return i;
}
function updateClock() {
var d = new Date();
var x = document.getElementById("time");
var z = document.getElementById("menutime");
var h = addZero(d.getHours());
var m = addZero(d.getMinutes());
x.innerHTML = h + ":" + m + " ";
z.innerHTML = h + ":" + m + " ";
setTimeout(updateClock, 1000);
}
updateClock(); // Starts clock cycle
</script>
<script onerror="failboot();">
var PADDING = 8;
var rect;
var viewport = {
bottom: 0,
left: 0,
right: 0,
top: 0
}
dragElement(document.getElementById("settings"));
dragElement(document.getElementById("terminal"));
dragElement(document.getElementById("tetris"));
function dragElement(elmnt) {
var pos1 = 0, pos2 = 0, pos3 = 0, pos4 = 0;
if (document.getElementById(elmnt.id + "header")) {
document.getElementById(elmnt.id + "header").onmousedown = dragMouseDown;
} else {
elmnt.onmousedown = dragMouseDown;
}
function dragMouseDown(e) {
e = e || window.event;
e.preventDefault();
pos3 = e.clientX;
pos4 = e.clientY;
document.onmouseup = closeDragElement;
document.onmousemove = elementDrag;
}
function elementDrag(e) {
e = e || window.event;
e.preventDefault();
pos1 = pos3 - e.clientX;
pos2 = pos4 - e.clientY;
pos3 = e.clientX;
pos4 = e.clientY;
elmnt.style.top = (elmnt.offsetTop - pos2) + "px";
elmnt.style.left = (elmnt.offsetLeft - pos1) + "px";
}
function closeDragElement() {
document.onmouseup = null;
document.onmousemove = null;
}
}
function delSettings() {
var nativewindow = document.getElementById("settings");
nativewindow.classList.remove("active")
nativewindow.style.display = 'none'
}
function buildSettings() {
var nativewindow = document.getElementById("settings");
nativewindow.style.display = 'block';
}
delSettings()
function delTerminal() {
var nativewindow = document.getElementById("terminal");
nativewindow.classList.remove("active")
nativewindow.style.display = 'none';
}
function buildTerminal() {
var nativewindow = document.getElementById("terminal");
nativewindow.style.display = 'block';
}
delTerminal()
function delTetris() {
var nativewindow = document.getElementById("tetris");
nativewindow.classList.remove("active")
nativewindow.style.display = 'none';
document.getElementById('tetrisgame').contentWindow.location.replace("./tetloader.html")
}
function buildTetris() {
var nativewindow = document.getElementById("tetris");
nativewindow.style.display = 'block';
document.getElementById('tetrisgame').contentWindow.location.replace("./tetris.html")
}
delTetris()
</script>
</body>
</html>
</div>
<script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
</script>