Skip to content

Commit d4a89c8

Browse files
committed
More work
1 parent 118d5cd commit d4a89c8

2 files changed

Lines changed: 123 additions & 5 deletions

File tree

beta/emuos/assets/js/emuos.js

Lines changed: 71 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@
413413

414414
// noinspection JSUnfilteredForInLoop
415415
var $icon = $('<a class="emuos-desktop-icon"'+ href + (icon_options['title'] ? 'data-title="' + icon_options['title'] + '"' : '') + '>' +
416-
'<i class="icon overlay ribbon' + (icon_options['shortcut'] ? ' shortcut' : '') + (icon_options['prototype'] ? ' prototype' : '') + (icon_options['beta'] ? ' beta' : '') + (icon_options['new'] ? ' new' : '') + '" style="background-image: url(' + icon + ($sys.browser.isIE ? '.png' : '.ico') + ');"></i>' +
416+
'<i class="' + self._buildIconClasses(icon_options, self.desktopIconSize) + '" style="background-image: url(' + icon + ($sys.browser.isIE ? '.png' : '.ico') + ');"></i>' +
417417
'<span>' + icon_options['name'] + '</span>' +
418418
'</a>');
419419

@@ -1828,6 +1828,7 @@
18281828
'--desktop-icon-cell-width': preset.width + 'px',
18291829
'--desktop-icon-cell-height': preset.height + 'px'
18301830
});
1831+
this._syncDesktopIconSizeClasses(size);
18311832
}
18321833
};
18331834

@@ -2055,6 +2056,73 @@
20552056
return icon;
20562057
};
20572058

2059+
EmuOS.prototype._getIconSizeClassName = function(size) {
2060+
size = parseInt(size, 10);
2061+
2062+
return isNaN(size) ? '' : 'size-' + size;
2063+
};
2064+
2065+
EmuOS.prototype._buildIconClasses = function(item, size) {
2066+
item = item || {};
2067+
var classes = 'icon overlay ribbon';
2068+
2069+
if (size) {
2070+
var sizeClass = this._getIconSizeClassName(size);
2071+
2072+
if (sizeClass) {
2073+
classes += ' ' + sizeClass;
2074+
}
2075+
}
2076+
2077+
if (item.shortcut) {
2078+
classes += ' shortcut';
2079+
}
2080+
2081+
if (item.prototype) {
2082+
classes += ' prototype';
2083+
}
2084+
2085+
if (item.beta) {
2086+
classes += ' beta';
2087+
}
2088+
2089+
if (item.new) {
2090+
classes += ' new';
2091+
}
2092+
2093+
return classes;
2094+
};
2095+
2096+
EmuOS.prototype._syncIconSizeClass = function($icon, size) {
2097+
if (!$icon || !$icon.length) {
2098+
return;
2099+
}
2100+
2101+
var sizeClass = this._getIconSizeClassName(size);
2102+
2103+
$icon.removeClass(function(index, className) {
2104+
return className.split(/\s+/).filter(function(name) {
2105+
return /^size-\d+$/.test(name);
2106+
}).join(' ');
2107+
});
2108+
2109+
if (sizeClass) {
2110+
$icon.addClass(sizeClass);
2111+
}
2112+
};
2113+
2114+
EmuOS.prototype._syncDesktopIconSizeClasses = function(size) {
2115+
var self = this;
2116+
2117+
if (!this.$desktop || !this.$desktop.length) {
2118+
return;
2119+
}
2120+
2121+
this.$desktop.find('.emuos-desktop-icon > i.icon').each(function() {
2122+
self._syncIconSizeClass($(this), size);
2123+
});
2124+
};
2125+
20582126
EmuOS.prototype._resolveLink = function(link) {
20592127
if (typeof link === 'undefined' || link === null || link === '') {
20602128
return '';
@@ -2681,7 +2749,7 @@
26812749
var detailIsFolder = detailItem.folder === true || Array.isArray(detailItem.items);
26822750
var detailIcon = self._resolveIcon(detailItem.icon, detailIsFolder ? 'assets/images/icons/desktop/folder' : 'assets/images/icons/desktop/joystick');
26832751
var detailName = typeof detailItem.name !== 'undefined' ? detailItem.name : 'Untitled';
2684-
var detailIconClasses = 'icon overlay ribbon' + (detailItem.shortcut ? ' shortcut' : '') + (detailItem.prototype ? ' prototype' : '') + (detailItem.beta ? ' beta' : '') + (detailItem.new ? ' new' : '');
2752+
var detailIconClasses = self._buildIconClasses(detailItem, 16);
26852753
var detailTitleAttr = detailItem.title ? ' data-title="' + detailItem.title + '"' : '';
26862754
var detailSize = self._formatFolderItemSize(detailItem);
26872755
var detailType = self._getFolderItemType(detailItem);
@@ -2712,7 +2780,7 @@
27122780
var isFolder = item.folder === true || Array.isArray(item.items);
27132781
var itemIcon = self._resolveIcon(item.icon, isFolder ? 'assets/images/icons/desktop/folder' : 'assets/images/icons/desktop/joystick');
27142782
var itemName = typeof item.name !== 'undefined' ? item.name : 'Untitled';
2715-
var iconClasses = 'icon overlay ribbon' + (item.shortcut ? ' shortcut' : '') + (item.prototype ? ' prototype' : '') + (item.beta ? ' beta' : '') + (item.new ? ' new' : '');
2783+
var iconClasses = self._buildIconClasses(item, size);
27162784
var titleAttr = item.title ? ' data-title="' + item.title + '"' : '';
27172785
var $item = $('<a class="emuos-folder-item" href="javascript:"' + titleAttr + '><i class="' + iconClasses + '"></i><span></span></a>');
27182786

beta/emuos/assets/styles/css/themes/basic/overlay.css

Lines changed: 52 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,38 @@
4949
visibility: hidden;
5050
}
5151

52-
.emuos-desktop-icon i.icon.ribbon.new:after,
53-
.emuos-folder-item i.icon.ribbon.new:after {
52+
.emuos-desktop-icon i.icon.size-128.ribbon.new:after,
53+
.emuos-folder-item i.icon.size-128.ribbon.new:after {
54+
background-image: url(../../../../images/icons/badges/new.png);
55+
background-size: 48px 48px;
56+
left: 96px;
57+
top: -8px;
58+
opacity: 1;
59+
visibility: visible;
60+
}
61+
62+
.emuos-desktop-icon i.icon.size-96.ribbon.new:after,
63+
.emuos-folder-item i.icon.size-96.ribbon.new:after {
64+
background-image: url(../../../../images/icons/badges/new.png);
65+
background-size: 48px 48px;
66+
left: 70px;
67+
top: -8px;
68+
opacity: 1;
69+
visibility: visible;
70+
}
71+
72+
.emuos-desktop-icon i.icon.size-64.ribbon.new:after,
73+
.emuos-folder-item i.icon.size-64.ribbon.new:after {
74+
background-image: url(../../../../images/icons/badges/new.png);
75+
background-size: 32px 32px;
76+
left: 38px;
77+
top: -16px;
78+
opacity: 1;
79+
visibility: visible;
80+
}
81+
82+
.emuos-desktop-icon i.icon.size-48.ribbon.new:after,
83+
.emuos-folder-item i.icon.size-48.ribbon.new:after {
5484
background-image: url(../../../../images/icons/badges/new.png);
5585
background-size: 28px 28px;
5686
left: 25px;
@@ -62,6 +92,26 @@
6292
visibility: visible;
6393
}
6494

95+
.emuos-desktop-icon i.icon.size-32.ribbon.new:after,
96+
.emuos-folder-item i.icon.size-32.ribbon.new:after {
97+
background-image: url(../../../../images/icons/badges/new.png);
98+
background-size: 24px 24px;
99+
left: 10px;
100+
top: -18px;
101+
opacity: 1;
102+
visibility: visible;
103+
}
104+
105+
.emuos-desktop-icon i.icon.size-24.ribbon.new:after,
106+
.emuos-folder-item i.icon.size-24.ribbon.new:after {
107+
background-image: url(../../../../images/icons/badges/new.png);
108+
background-size: 24px 24px;
109+
left: 0;
110+
top: -18px;
111+
opacity: 1;
112+
visibility: visible;
113+
}
114+
65115
.emuos-desktop-icon i.icon.ribbon.beta:after,
66116
.emuos-folder-item i.icon.ribbon.beta:after {
67117
background-image: url(../../../../images/icons/ribbon/beta.png);

0 commit comments

Comments
 (0)