Skip to content

Commit 26e45d1

Browse files
committed
fix copy OSD layout for electron
1 parent 4dfd16d commit 26e45d1

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

tabs/osd.js

+16-9
Original file line numberDiff line numberDiff line change
@@ -3160,22 +3160,26 @@ OSD.GUI.updateAll = function() {
31603160
}
31613161
});
31623162

3163-
paste.on('click', function() {
3163+
paste.on('click', async function() {
31643164
if(layout_clipboard.filled == true){
31653165

31663166
var oldLayout = JSON.parse(JSON.stringify(OSD.data.layouts[OSD.data.selected_layout]))
31673167
OSD.data.layouts[OSD.data.selected_layout] = JSON.parse(JSON.stringify(layout_clipboard.layout));
31683168
layouts.trigger('change');
3169-
OSD.data.layouts[OSD.data.selected_layout].forEach(function(item, index){
3169+
3170+
for(var index in OSD.data.layouts[OSD.data.selected_layout])
3171+
{
3172+
var item = OSD.data.layouts[OSD.data.selected_layout][index];
31703173
if(!(item.isVisible === false && oldLayout[index].isVisible === false) && (oldLayout[index].x !== item.x || oldLayout[index].y !== item.y || oldLayout[index].position !== item.position || oldLayout[index].isVisible !== item.isVisible)){
3171-
OSD.saveItem({id: index});
3174+
await OSD.saveItem({id: index});
31723175
}
3173-
});
3176+
}
3177+
31743178
GUI.log(i18n.getMessage('osdLayoutPasteFromClipboard'));
31753179
}
31763180
});
31773181

3178-
clear.on('click', function() {
3182+
clear.on('click', async function() {
31793183
var oldLayout = JSON.parse(JSON.stringify(OSD.data.layouts[OSD.data.selected_layout]));
31803184

31813185
var clearedLayout = [];
@@ -3187,12 +3191,15 @@ OSD.GUI.updateAll = function() {
31873191

31883192
OSD.data.layouts[OSD.data.selected_layout] = clearedLayout;
31893193
layouts.trigger('change');
3190-
OSD.data.layouts[OSD.data.selected_layout].forEach(function(item, index){
3194+
3195+
for(var index in OSD.data.layouts[OSD.data.selected_layout]) {
3196+
var item = OSD.data.layouts[OSD.data.selected_layout][index];
31913197
if(oldLayout[index].isVisible === true){
3192-
OSD.saveItem({id: index});
3198+
await OSD.saveItem({id: index});
31933199
}
3194-
});
3195-
GUI.log(chrome.i18n.getMessage('osdClearLayout'));
3200+
}
3201+
3202+
GUI.log(i18n.getMessage('osdClearLayout'));
31963203
});
31973204

31983205

0 commit comments

Comments
 (0)