From 26e45d158542669d6bbe624fd6e5506f6d3077d6 Mon Sep 17 00:00:00 2001 From: error414 Date: Tue, 10 Sep 2024 21:08:01 +0200 Subject: [PATCH] fix copy OSD layout for electron --- tabs/osd.js | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/tabs/osd.js b/tabs/osd.js index 00d920821..567a07921 100644 --- a/tabs/osd.js +++ b/tabs/osd.js @@ -3160,22 +3160,26 @@ OSD.GUI.updateAll = function() { } }); - paste.on('click', function() { + paste.on('click', async function() { if(layout_clipboard.filled == true){ var oldLayout = JSON.parse(JSON.stringify(OSD.data.layouts[OSD.data.selected_layout])) OSD.data.layouts[OSD.data.selected_layout] = JSON.parse(JSON.stringify(layout_clipboard.layout)); layouts.trigger('change'); - OSD.data.layouts[OSD.data.selected_layout].forEach(function(item, index){ + + for(var index in OSD.data.layouts[OSD.data.selected_layout]) + { + var item = OSD.data.layouts[OSD.data.selected_layout][index]; 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)){ - OSD.saveItem({id: index}); + await OSD.saveItem({id: index}); } - }); + } + GUI.log(i18n.getMessage('osdLayoutPasteFromClipboard')); } }); - clear.on('click', function() { + clear.on('click', async function() { var oldLayout = JSON.parse(JSON.stringify(OSD.data.layouts[OSD.data.selected_layout])); var clearedLayout = []; @@ -3187,12 +3191,15 @@ OSD.GUI.updateAll = function() { OSD.data.layouts[OSD.data.selected_layout] = clearedLayout; layouts.trigger('change'); - OSD.data.layouts[OSD.data.selected_layout].forEach(function(item, index){ + + for(var index in OSD.data.layouts[OSD.data.selected_layout]) { + var item = OSD.data.layouts[OSD.data.selected_layout][index]; if(oldLayout[index].isVisible === true){ - OSD.saveItem({id: index}); + await OSD.saveItem({id: index}); } - }); - GUI.log(chrome.i18n.getMessage('osdClearLayout')); + } + + GUI.log(i18n.getMessage('osdClearLayout')); });