Skip to content

Commit 3f9fe95

Browse files
committed
More work
1 parent d5b99d6 commit 3f9fe95

2 files changed

Lines changed: 153 additions & 71 deletions

File tree

beta/emuos/assets/data/desktop.json

Lines changed: 84 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,90 @@
299299
"height": 440,
300300
"share": true
301301
}]
302+
} , {
303+
"name": "Incomplete Games",
304+
"title": "Folder",
305+
"icon": "assets/images/icons/desktop/folder-gray",
306+
"folder": true,
307+
"width": 760,
308+
"height": 560,
309+
"items": [{
310+
"name": "Raptor: Call of the Shadows",
311+
"title": "Unfinished Game",
312+
"icon": "assets/images/icons/desktop/raptor",
313+
"link": "/emupedia-game-raptor/",
314+
"credits": "HTML5 Port<hr />Author: <a href=\"https://github.com/robgietema\" target=\"_blank\">github.com/robgietema</a><br />Repository: <a href=\"https://github.com/robgietema/raptor\" target=\"_blank\">github.com/robgietema/raptor</a><br /><br />All other assets<hr />Copyright Apogee Software",
315+
"newtab": true,
316+
"disclaimer_abandoned": true,
317+
"width": 640,
318+
"height": 400,
319+
"share": true
320+
} , {
321+
"name": "Command and Conquer: Red Alert 2",
322+
"title": "Unfinished Game",
323+
"icon": "assets/images/icons/desktop/red-alert2",
324+
"link": "/emupedia-game-ra2/",
325+
"credits": "HTML5 Port<hr />Website: <a href=\"https://ra2html5.surge.sh/\" target=\"_blank\">ra2html5.surge.sh</a><br /><br />Author: Võ Thành Đạt<br /><br />All other assets<hr />Copyright Electronic Arts (formerly Westwood Studios)",
326+
"disclaimer": true,
327+
"width": 900,
328+
"height": 550,
329+
"newtab": true,
330+
"share": true
331+
} , {
332+
"name": "1v1.LOL",
333+
"title": "Server Offline",
334+
"icon": "assets/images/icons/desktop/1v1.lol",
335+
"link": "/emupedia-game-1v1.lol/",
336+
"credits": "Original project<hr />Website: <a href=\"https://1v1.lol\" target=\"_blank\">1v1.lol</a><br />Copyright: JustPlay.LOL",
337+
"disclaimer": true,
338+
"width": 900,
339+
"height": 600,
340+
"newtab": true,
341+
"shortcut": true,
342+
"share": true
343+
}]
344+
} , {
345+
"name": "Similar OS",
346+
"title": "Folder",
347+
"icon": "assets/images/icons/desktop/folder",
348+
"folder": true,
349+
"width": 760,
350+
"height": 560,
351+
"items": [{
352+
"name": "98.js",
353+
"title": "External Website",
354+
"icon": "assets/images/icons/desktop/98.js",
355+
"credits": "Website: <a href=\"https://98.js.org\" target=\"_blank\">98.js.org</a><br /><br />Author: <a href=\"https://github.com/1j01\" target=\"_blank\">github.com/1j01</a><br />Repository: <a href=\"https://github.com/1j01/98\" target=\"_blank\">github.com/1j01/98</a>",
356+
"disclaimer_abandoned": true,
357+
"link": "https://98.js.org/",
358+
"width": 960,
359+
"height": 713,
360+
"newtab": true,
361+
"shortcut": true,
362+
"share": true
363+
} , {
364+
"name": "Windows 93",
365+
"title": "External Website",
366+
"icon": "assets/images/icons/desktop/windows93",
367+
"link": "https://windows93.net",
368+
"target": "_blank",
369+
"credits": "Website: <a href=\"https://windows93.net\" target=\"_blank\">windows93.net</a><br /><br />Author(s): <a href=\"http://jankenpopp.com\" target=\"_blank\">Jankenpopp</a> &amp; <a href=\"https://zombect.ro\" target=\"_blank\">Zombectro</a><br />License: <a href=\"https://www.windows93.net/#!/c/TOS.html\" target=\"_blank\">CC BY-NC 4.0</a>",
370+
"width": 960,
371+
"height": 734,
372+
"newtab": true,
373+
"shortcut": true
374+
} , {
375+
"name": "Windows 96",
376+
"title": "External Website",
377+
"icon": "assets/images/icons/desktop/windows96",
378+
"link": "https://windows96.net",
379+
"credits": "Website: <a href=\"https://windows96.net\" target=\"_blank\">windows96.net</a><br /><br />Author(s): <a href=\"https://sys36.net\" target=\"_blank\">ctrlz &amp; ziad87</a>",
380+
"width": 960,
381+
"height": 734,
382+
"newtab": true,
383+
"shortcut": true,
384+
"share": true
385+
}]
302386
} , {
303387
"name": "Santa Tracker",
304388
"title": "External Website",
@@ -310,40 +394,6 @@
310394
"newtab": true,
311395
"shortcut": true,
312396
"xmas": true
313-
} , {
314-
"name": "Windows 93",
315-
"title": "External Website",
316-
"icon": "assets/images/icons/desktop/windows93",
317-
"link": "https://windows93.net",
318-
"target": "_blank",
319-
"credits": "Website: <a href=\"https://windows93.net\" target=\"_blank\">windows93.net</a><br /><br />Author(s): <a href=\"http://jankenpopp.com\" target=\"_blank\">Jankenpopp</a> &amp; <a href=\"https://zombect.ro\" target=\"_blank\">Zombectro</a><br />License: <a href=\"https://www.windows93.net/#!/c/TOS.html\" target=\"_blank\">CC BY-NC 4.0</a>",
320-
"width": 960,
321-
"height": 734,
322-
"newtab": true,
323-
"shortcut": true
324-
} , {
325-
"name": "Windows 96",
326-
"title": "External Website",
327-
"icon": "assets/images/icons/desktop/windows96",
328-
"link": "https://windows96.net",
329-
"credits": "Website: <a href=\"https://windows96.net\" target=\"_blank\">windows96.net</a><br /><br />Author(s): <a href=\"https://sys36.net\" target=\"_blank\">ctrlz &amp; ziad87</a>",
330-
"width": 960,
331-
"height": 734,
332-
"newtab": true,
333-
"shortcut": true,
334-
"share": true
335-
} , {
336-
"name": "98.js",
337-
"title": "External Website",
338-
"icon": "assets/images/icons/desktop/98.js",
339-
"credits": "Website: <a href=\"https://98.js.org\" target=\"_blank\">98.js.org</a><br /><br />Author: <a href=\"https://github.com/1j01\" target=\"_blank\">github.com/1j01</a><br />Repository: <a href=\"https://github.com/1j01/98\" target=\"_blank\">github.com/1j01/98</a>",
340-
"disclaimer_abandoned": true,
341-
"link": "https://98.js.org/",
342-
"width": 960,
343-
"height": 713,
344-
"newtab": true,
345-
"shortcut": true,
346-
"share": true
347397
} , {
348398
"name": "Friday Night Funkin'",
349399
"title": "External Website",
@@ -641,18 +691,6 @@
641691
"newtab": true,
642692
"shortcut": true,
643693
"share": true
644-
} , {
645-
"name": "1v1.LOL",
646-
"title": "External Website",
647-
"icon": "assets/images/icons/desktop/1v1.lol",
648-
"link": "/emupedia-game-1v1.lol/",
649-
"credits": "Original project<hr />Website: <a href=\"https://1v1.lol\" target=\"_blank\">1v1.lol</a><br />Copyright: JustPlay.LOL",
650-
"disclaimer": true,
651-
"width": 900,
652-
"height": 600,
653-
"newtab": true,
654-
"shortcut": true,
655-
"share": true
656694
} , {
657695
"name": ".io Games",
658696
"title": "Folder",
@@ -764,16 +802,6 @@
764802
"shortcut": true,
765803
"share": true
766804
}]
767-
} , {
768-
"name": "Raptor: Call of the Shadows",
769-
"icon": "assets/images/icons/desktop/raptor",
770-
"link": "/emupedia-game-raptor/",
771-
"credits": "HTML5 Port<hr />Author: <a href=\"https://github.com/robgietema\" target=\"_blank\">github.com/robgietema</a><br />Repository: <a href=\"https://github.com/robgietema/raptor\" target=\"_blank\">github.com/robgietema/raptor</a><br /><br />All other assets<hr />Copyright Apogee Software",
772-
"newtab": true,
773-
"disclaimer_abandoned": true,
774-
"width": 640,
775-
"height": 400,
776-
"share": true
777805
} , {
778806
"name": "Pikachu Volleyball",
779807
"title": "Under Development",
@@ -1156,16 +1184,6 @@
11561184
"height": 535,
11571185
"newtab": true,
11581186
"share": true
1159-
} , {
1160-
"name": "Command and Conquer: Red Alert 2",
1161-
"icon": "assets/images/icons/desktop/red-alert2",
1162-
"link": "/emupedia-game-ra2/",
1163-
"credits": "HTML5 Port<hr />Website: <a href=\"https://ra2html5.surge.sh/\" target=\"_blank\">ra2html5.surge.sh</a><br /><br />Author: Võ Thành Đạt<br /><br />All other assets<hr />Copyright Electronic Arts (formerly Westwood Studios)",
1164-
"disclaimer": true,
1165-
"width": 900,
1166-
"height": 550,
1167-
"newtab": true,
1168-
"share": true
11691187
} , {
11701188
"name": "Tomb Raider",
11711189
"title": "Under Development",

beta/emuos/assets/js/emuos.js

Lines changed: 69 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,7 @@
254254

255255
self.options = $.extend(true, {}, options);
256256
self._foldersByPath = {};
257+
self.useFolders = self._getUseFoldersSetting();
257258

258259
// noinspection FallThroughInSwitchStatementJS
259260
switch (self.options.theme) {
@@ -349,9 +350,11 @@
349350
self.$desktop = $('.desktop').first();
350351
self.$taskbar = $('.taskbar').first();
351352

352-
for (var j in self.options.icons) {
353+
var desktopIcons = self._getDesktopIcons(self.options.icons, self.useFolders);
354+
355+
for (var j in desktopIcons) {
353356
// noinspection JSUnfilteredForInLoop,JSDuplicatedDeclaration
354-
var icon_options = self.options.icons[j];
357+
var icon_options = desktopIcons[j];
355358

356359
if (typeof icon_options['requires'] === 'object') {
357360
var reqs = Object.keys(icon_options['requires']);
@@ -1093,11 +1096,26 @@
10931096
title: 'Windows ME',
10941097
cmd: 'windows-me'
10951098
}]
1099+
} , {
1100+
title: '----'
1101+
} , {
1102+
title: 'Use Folders',
1103+
cmd: 'toggle-folders',
1104+
uiIcon: self.useFolders ? 'ui-icon-check' : ''
10961105
}],
10971106
select: function(e, ui) {
10981107
switch (ui.cmd) {
10991108
case 'refresh':
11001109
// noinspection JSUnresolvedFunction
1110+
window.location.reload();
1111+
break;
1112+
case 'toggle-folders':
1113+
self.useFolders = !self.useFolders;
1114+
1115+
if (typeof simplestorage !== 'undefined' && typeof simplestorage.set === 'function') {
1116+
simplestorage.set('useFolders', self.useFolders);
1117+
}
1118+
11011119
window.location.reload();
11021120
break;
11031121
case 'basic':
@@ -1169,7 +1187,7 @@
11691187

11701188
if (typeof simplestorage !== 'undefined') {
11711189
if (typeof simplestorage.set === 'function') {
1172-
if (ui.cmd !== 'refresh') {
1190+
if (ui.cmd === 'basic' || ui.cmd === 'windows-3' || ui.cmd === 'windows-95' || ui.cmd === 'windows-98' || ui.cmd === 'windows-me') {
11731191
simplestorage.set('theme', ui.cmd);
11741192
}
11751193
}
@@ -1199,9 +1217,9 @@
11991217
route = route.slice(0, route.lastIndexOf('?'));
12001218
}
12011219

1202-
for (var j in self.options.icons) {
1220+
for (var j in desktopIcons) {
12031221
// noinspection JSUnfilteredForInLoop,JSDuplicatedDeclaration
1204-
var icon_options = self.options.icons[j];
1222+
var icon_options = desktopIcons[j];
12051223

12061224
if (typeof icon_options['link'] !== 'undefined') {
12071225
var icon_link = '';
@@ -1244,6 +1262,48 @@
12441262
}
12451263
};
12461264

1265+
EmuOS.prototype._getUseFoldersSetting = function() {
1266+
if (typeof simplestorage === 'undefined' || typeof simplestorage.get !== 'function') {
1267+
return true;
1268+
}
1269+
1270+
var value = simplestorage.get('useFolders');
1271+
1272+
return typeof value === 'boolean' ? value : true;
1273+
};
1274+
1275+
EmuOS.prototype._flattenDesktopIcons = function(icons) {
1276+
var flattened = [];
1277+
1278+
if (!Array.isArray(icons)) {
1279+
return flattened;
1280+
}
1281+
1282+
for (var i = 0; i < icons.length; i++) {
1283+
var icon = icons[i] || {};
1284+
var isFolder = icon.folder === true || Array.isArray(icon.items);
1285+
1286+
if (isFolder) {
1287+
var childItems = Array.isArray(icon.items) ? icon.items : [];
1288+
var children = this._flattenDesktopIcons(childItems);
1289+
1290+
for (var j = 0; j < children.length; j++) {
1291+
flattened.push(children[j]);
1292+
}
1293+
1294+
continue;
1295+
}
1296+
1297+
flattened.push(icon);
1298+
}
1299+
1300+
return flattened;
1301+
};
1302+
1303+
EmuOS.prototype._getDesktopIcons = function(icons, useFolders) {
1304+
return useFolders ? icons : this._flattenDesktopIcons(icons);
1305+
};
1306+
12471307
EmuOS.prototype._registerFolderDefinition = function(folder, path) {
12481308
if (!folder) {
12491309
return;
@@ -1338,6 +1398,10 @@
13381398
};
13391399

13401400
EmuOS.prototype._restoreFolderWindows = function() {
1401+
if (!this.useFolders) {
1402+
return;
1403+
}
1404+
13411405
var states = this._getStoredFolderWindows();
13421406

13431407
for (var i = 0; i < states.length; i++) {

0 commit comments

Comments
 (0)