This repository was archived by the owner on Feb 12, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathindex.php
416 lines (400 loc) · 13.4 KB
/
index.php
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
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>
<script src="/js/jquery.ui.touch-punch.min.js"></script>
<link rel="stylesheet" type="text/css" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.7.1/themes/base/jquery-ui.css"/>
<!-- classes were from SparrOS Developer Team -->
<title>DremJS</title>
<style>
.framewrap {
width:500px;
height:300px;
padding:10px;
position: fixed;
top: 50px;
left: 10px;
background-color:#87CEEB;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
}
.framewrapMobile {
width:100%;
height:100%;
/*padding:10px;*/
position: fixed;
top: 50px;
left: 0px;
background-color:#87CEEB;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
}
.appFrame {
width:99%;
height:93%;
background-color:#FFFFFF;
}
.appFrameMobile {
width:99%;
height:99%;
background-color:#FFFFFF;
}
.cwhite {
color: white;
}
.br1 {
position: absolute;
bottom: 8px;
right: 16px;
font-size: 12px;
}
.br2 {
position: absolute;
bottom: 22px;
right: 16px;
font-size: 12px;
}
.br3 {
position: absolute;
bottom: 36px;
right: 16px;
font-size: 12px;
}
html {
background: url(DremJS-Background.png) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
body {
font-family: Calibri;
margin:0px;
}
a:link {
color: black;
text-decoration: none;
}
a:visited {
color: black;
text-decoration: none;
}
.cent {
position: relative;
top: 4px;
}
.taskbar {
background-color: black;
position: absolute;
top: 0;
right: 0;
width: 100%;
/*z-index: 20000;*/
}
.taskbarTime {
height: 42px;
float: left;
}
.taskbarApps {
text-align: center;
float: left;
margin-left: 5px;
padding: 2px;
border-radius: 6px;
//border: 2px solid #FFFFFF;
}
.taskbarAppOpen {
border: 2px solid #FFFFFF;
//border-style: solid;
//border-color: white;
//border-width: 2px;
//background-color: white;
//border: 2px solid #FFFFFF;
}
.startbtn {
background-color: transparent;
color: black;
padding: 8px; // Bad way of doing this but that's a problem for future Sam
font-size: 16px;
border: none;
z-index: 30000;
}
.start-content {
display: none;
position: absolute;
right:0px;
background-color: #f9f9f9;
min-width: 200px;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
padding: 12px 16px;
z-index: 30000;
}
.start {
position: absolute;
display: inline-block;
top:0px;
right:0px;
z-index:30000;
}
.start-content a:hover {background-color: #ccc}
.start:hover .start-content {
display: block;
}
.start:hover .startbtn {
background-color: gray;
}
#context-menu {
position:fixed;
z-index:30000;
width:150px;
background:#1b1a1a;
/*border-radius:5px;*/
transform:scale(0);
transform-origin:top left;
}
#context-menu.active {
transform:scale(1);
transition:transform 300ms ease-in-out;
}
#context-menu .item {
padding:8px 10px;
font-size:15px;
color:#eee;
}
#context-menu .item:hover {
background:#555;
}
#context-menu .item i {
display:inline-block;
margin-right:5px;
}
#context-menu hr {
margin:2px 0px;
border-color:#555;
}
</style>
</head>
<body onload="initAgendaWM(); touchstart();">
<div id="main" tabindex="-1">
<p class="cwhite br2">DremJS Version 0.1.7b</p>
<p class="cwhite br1">© Innovation Inc.</p>
<div id="context-menu">
</div>
<div class="start">
<button class="startbtn"><img src="/assets/media/images/logo.png" style="width:24px;height24px;"></button>
<div class="start-content">
<a onclick="openApplication('about', 800, 500, 'about.png')"><p><img src="apps/about/about.png" align="top"> About DremJS</p></a>
<a onclick="openApplication('howto', 800, 500, 'howto.png')"><p><img src="apps/howto/howto.png" align="top"> How to Install Applications</p></a>
<a onclick="openApplication('market', 'max', 'max', 'market.png')"><p><img src="apps/market/market.png" align="top"> DremJS Market</p></a>
<a onclick="openApplication('debug', 700, 450, 'debug.png')"><p><img src="apps/debug/debug.png" align="top"> Report a Bug</p></a>
<a onclick="openApplication('FileManager', 700, 450, 'filemanager.png')"><p><img src="apps/FileManager/filemanager.png" align="top" width="16" height="16"> File Manager</p></a>
<a onclick="openApplication('Cinema', 700, 450, 'cinema.png')"><p><img src="apps/Cinema/cinema.png" align="top" width="16" height="16"> Cinema</p></a>
<a onclick="openApplication('Notepad', 700, 450, 'notepad.png')"><p><img src="apps/Notepad/notepad.png" align="top" width="16" height="16"> Notepad</p></a>
<a onclick="openApplication('terminal', 700, 450, 'terminal.png')"><p><img src="apps/terminal/terminal.png" align="top" width="16" height="16"> Terminal</p></a>
<a onclick="openApplication('serverstatus', '300', '300', 'serverstatus.png')"><p><img src="apps/serverstatus/serverstatus.png" align="top" style="width:16px;height:16px;"> Server Status</p></a>
<a onclick="openApplication('widgets-settings', -1, -1, 'widgets-settings.png')"><p><img src="apps/widgets-settings/widgets-settings.png" align="top" style="width:16px;height:16px"> Widgets Settings</p></a>
<hr />
<a target="_top" href="shuttingdown.html"><p><img src="/assets/media/images/shutdown.png" align="top" style="width:16px;height:16px;"> Shutdown DremJS</p></a>
</div>
</div>
<div id="appContainer">
<!-- This is the taskbar -->
<div id="taskbar" class="taskbar">
<div id="taskbarTime" class="taskbarTime">
<!-- Add apps here -->
<div class="cwhite" style="text-align:left" id="txt"></div> <a onclick="openApplication('about', 800, 500, 'about.png')"><img src="apps/about/about.png"> |</a>
</div>
<div id="taskbarApps">
</div>
</div>
</div>
</div>
<script src="/js/agenda/mobile-detect.js"></script>
<script src="/js/agenda/agenda-wm.js"></script>
<script>
var counter;
var pressHoldDuration = 50;
var pressHoldEvent = new CustomEvent("pressHold");
var timerID;
//var currentSelectedTaskbarApp = "";
var allowContextMenuFlag = true;
var firstTouchFlag = false;
$("#context-menu").hover(function() {
allowContextMenuFlag = false;
}, function() {
allowContextMenuFlag = true;
})
window.addEventListener("contextmenu",function(event){
event.preventDefault();
});
window.onmousedown = function(eventData) {
if (eventData.button === 2) {
showContextMenu();
}
}
window.addEventListener("click",function(){
closeContextMenu();
});
function showContextMenu(appid) {
if(allowContextMenuFlag == false) { return; }
// Base context menu
var contextMenuItems = '<!-- DremJS Global Functions -->'
/*<div onclick="" class="item">\
<i class="fa"></i> Item\
</div>*/
if(!detector.mobile()) {
contextMenuItems+='<div onclick="minimizeAllApplications();" class="item">\
<i class="fa"></i> Show Desktop\
</div>'
}
contextMenuItems+='</hr>\
<!-- Application-Specific Functions -->\
\
'
if(GetCurrentTaskbarApp() != "") {
contextMenuItems+='<div onclick="closeApplication(' + GetCurrentTaskbarApp() + ')" class="item">\
<i class="fa"></i> Close Application\
</div>';
} else if($(":focus").attr('class') == "taskbarApps") {
contextMenuItems+='<div onclick="closeApplication(' + $(":focus").attr('id').substr(4, $(":focus").attr('id').length) + ')" class="item">\
<i class="fa"></i> Close Application\
</div>';
}
SetCurrentTaskbarApp("");
// Grab 2D array of elements and corresponding JavaScript functions (should be JSON but I don't know how to JSON)
var failedFlag = false;
//if(appid) {
id=appid;
//} else {
// var id=$(':focus').attr('id');
//}
try {
var applicationFunctions = document.getElementById(id).contentWindow.GetDremJSMenuFunctions();
} catch(e) {
//console.log("An error occured trying to get custom context menu functions from the application. This probably means the application hasn't been updated for modern versions of DremJS. No custom context menu items will be displayed.")
//console.log(e);
failedFlag = true;
}
if (failedFlag == false) {
contextMenuItems+="<hr />"
for(i=0; i<applicationFunctions.length; i++) {
if(applicationFunctions[i][0] == "<hr />")
contextMenuItems+="<hr />";
else
contextMenuItems+="<div class='item' onclick=\"document.getElementById('" + id + "').contentWindow." + applicationFunctions[i][1] + "\">\n\t<i class='fa'></i> " + applicationFunctions[i][0] +"\n</div>";
}
//console.log(contextMenuItems);
}
//console.log(contextMenuItems);
var contextElement = document.getElementById("context-menu");
contextElement.innerHTML = '';
contextElement.insertAdjacentHTML('beforeend', contextMenuItems);
//posX = event.clientX;
//posY = event.clientY;
if(!(detector.mobile())) {
posX = event.clientX;
posY = event.clientY;
if(appid || (document.getElementById(id) && document.getElementById(id).tagName == "IFRAME")) {
posX = document.getElementById(id).getBoundingClientRect().left + posX;
posY = document.getElementById(id).getBoundingClientRect().top + posY;
}
contextElement.style.top = posY + "px";
contextElement.style.left = posX + "px";
} else {
// This is what we in the business call a bodge
if(appid) {
contextElement.style.top = document.getElementById(id).getBoundingClientRect().top + "px";
contextElement.style.left = document.getElementById(id).getBoundingClientRect().left + "px";
} else {
contextElement.style.top = clientY + "px";
contextElement.style.left = clientX + "px";
}
}
setTimeout(function() { contextElement.classList.add("active"); }, 10);
}
function closeContextMenu() {
document.getElementById("context-menu").classList.remove("active");
}
function canAccessIFrame(iframe) {
var html = null;
try {
var doc = iframe.contentDocument || iframe.contentWindow.document;
html = doc.body.innerHTML;
} catch(err){
return false;
}
return true;
}
var monitor = setInterval(function(){
//var elem = document.activeElement;
var elem = $(':focus');
if(elem && $(elem).prop("tagName") == 'IFRAME' && canAccessIFrame(elem.get(0))){
elem.contents().find("body").mousedown(function(event) {
switch (event.which) {
case 1:
//console.log('Left mouse button pressed - ' + elem.attr('name'));
closeContextMenu();
break;
case 2:
//console.log('Middle mouse button pressed');
break;
case 3:
//console.log('Right mouse button pressed - ' + elem.attr('id'));
showContextMenu(elem.attr('id'));
break;
default:
console.log('You have a strange mouse');
break;
}
});
}
}, 100);
var clientX;
var clientY;
var startX;
var startY;
var currentX;
var currentY;
var onlongtouch;
var timer;
var touchduration = 800; //length of time we want the user to touch before we do something
window.addEventListener('touchstart', function(e) {
clientX = e.touches[0].clientX;
clientY = e.touches[0].clientY;
currentX = clientX;
currentY = clientY;
//DelayBeforeContextMenu = setTimeout(showContextMenu(), touchduration);
});
function touchstart(e) {
//e.preventDefault();
startX = clientX;
startY = clientY;
if (!timer) {
timer = setTimeout(onlongtouch, touchduration);
}
}
function touchend() {
//stops short touches from firing the event
if (timer) {
clearTimeout(timer);
timer = null;
}
}
onlongtouch = function() {
timer = null;
if(firstTouchFlag && Math.abs(startX - currentX) < 50 && Math.abs(startY - currentY) < 50) {
showContextMenu();
} else {
firstTouchFlag=true;
}
};
function updateXY(e) {
currentX = e.touches[0].clientX;
currentY = e.touches[0].clientY;
}
document.addEventListener("DOMContentLoaded", function(event) {
window.addEventListener("touchstart", touchstart, false);
window.addEventListener("touchend", touchend, false);
window.addEventListener("touchmove", updateXY, true);
});
</script>
</body>
</html>