Skip to content

Commit a4b2acf

Browse files
committed
More work
1 parent 8fd3808 commit a4b2acf

File tree

1 file changed

+55
-45
lines changed

1 file changed

+55
-45
lines changed

beta/emuos/assets/js/emuos.js

Lines changed: 55 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1079,58 +1079,62 @@
10791079
}
10801080
});
10811081

1082-
var hasCustomWallpaper = !!self._getCustomWallpaper();
1083-
var desktopMenu = [{
1084-
title: 'Refresh',
1085-
cmd: 'refresh',
1086-
uiIcon: 'ui-icon-refresh'
1087-
} , {
1088-
title: '----'
1089-
} , {
1090-
title: 'Custom Wallpaper',
1091-
cmd: 'custom-wallpaper',
1092-
uiIcon: 'ui-icon-image'
1093-
}];
1094-
1095-
if (hasCustomWallpaper) {
1096-
desktopMenu.push({
1097-
title: 'Remove Custom Wallpaper',
1098-
cmd: 'remove-custom-wallpaper',
1099-
uiIcon: 'ui-icon-trash'
1100-
});
1101-
}
1102-
1103-
desktopMenu = desktopMenu.concat([{
1104-
title: '----'
1105-
} , {
1106-
title: 'Themes',
1107-
children: [{
1108-
title: 'Basic',
1109-
cmd: 'basic'
1082+
var getDesktopMenu = function() {
1083+
var hasCustomWallpaper = !!self._getCustomWallpaper();
1084+
var desktopMenu = [{
1085+
title: 'Refresh',
1086+
cmd: 'refresh',
1087+
uiIcon: 'ui-icon-refresh'
11101088
} , {
1111-
title: 'Windows 3.1',
1112-
cmd: 'windows-3'
1089+
title: '----'
11131090
} , {
1114-
title: 'Windows 95',
1115-
cmd: 'windows-95'
1091+
title: 'Set Custom Wallpaper',
1092+
cmd: 'custom-wallpaper',
1093+
uiIcon: 'ui-icon-image'
1094+
}];
1095+
1096+
if (hasCustomWallpaper) {
1097+
desktopMenu.push({
1098+
title: 'Remove Custom Wallpaper',
1099+
cmd: 'remove-custom-wallpaper',
1100+
uiIcon: 'ui-icon-trash'
1101+
});
1102+
}
1103+
1104+
desktopMenu = desktopMenu.concat([{
1105+
title: '----'
11161106
} , {
1117-
title: 'Windows 98',
1118-
cmd: 'windows-98'
1107+
title: 'Themes',
1108+
children: [{
1109+
title: 'Basic',
1110+
cmd: 'basic'
1111+
} , {
1112+
title: 'Windows 3.1',
1113+
cmd: 'windows-3'
1114+
} , {
1115+
title: 'Windows 95',
1116+
cmd: 'windows-95'
1117+
} , {
1118+
title: 'Windows 98',
1119+
cmd: 'windows-98'
1120+
} , {
1121+
title: 'Windows ME',
1122+
cmd: 'windows-me'
1123+
}]
11191124
} , {
1120-
title: 'Windows ME',
1121-
cmd: 'windows-me'
1122-
}]
1123-
} , {
1124-
title: '----'
1125-
} , {
1126-
title: 'Use Folders',
1127-
cmd: 'toggle-folders',
1128-
uiIcon: self.useFolders ? 'ui-icon-check' : ''
1129-
}]);
1125+
title: '----'
1126+
} , {
1127+
title: 'Use Folders',
1128+
cmd: 'toggle-folders',
1129+
uiIcon: self.useFolders ? 'ui-icon-check' : ''
1130+
}]);
1131+
1132+
return desktopMenu;
1133+
};
11301134

11311135
self.$html.contextmenu({
11321136
delegate: '.emuos-desktop, .emuos-taskbar',
1133-
menu: desktopMenu,
1137+
menu: getDesktopMenu(),
11341138
select: function(e, ui) {
11351139
switch (ui.cmd) {
11361140
case 'refresh':
@@ -1232,6 +1236,12 @@
12321236
}
12331237
});
12341238

1239+
self.$html.off('mousedown.emuosDesktopMenu').on('mousedown.emuosDesktopMenu', '.emuos-desktop, .emuos-taskbar', function(e) {
1240+
if (e.which === 3) {
1241+
self.$html.contextmenu('option', 'menu', getDesktopMenu());
1242+
}
1243+
});
1244+
12351245
self.$html.on('mousemove', function (e) {
12361246
var parentOffset = $(e.target).offset();
12371247
var relX = e.pageX - parentOffset.left;

0 commit comments

Comments
 (0)