From c1c08f940059915f9a556d8ab8c48674298fbbf0 Mon Sep 17 00:00:00 2001 From: Ryan Blenis Date: Wed, 11 Dec 2019 21:12:39 -0500 Subject: [PATCH] Remember the last plugin tab and jump back to it. --- pluginHandler.js | 3 ++- views/default.handlebars | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/pluginHandler.js b/pluginHandler.js index 6e8d31a7..a1659051 100644 --- a/pluginHandler.js +++ b/pluginHandler.js @@ -97,7 +97,7 @@ module.exports.pluginHandler = function (parent) { if (!Q(d.tabId)) { var defaultOn = 'class="on"'; if (Q('p19headers').querySelectorAll("span.on").length) defaultOn = ''; - QA('p19headers', ''+d.tabTitle+''); + QA('p19headers', ''+d.tabTitle+''); QA('p19pages', '
'); } QV('MainDevPlugins', true); @@ -109,6 +109,7 @@ module.exports.pluginHandler = function (parent) { var tabs = Q('p19headers').querySelectorAll("span"); for (const i of tabs) { i.classList.remove('on'); } el.classList.add('on'); + putstore('_curPluginPage', id); }; obj.addPluginEx = function() { meshserver.send({ action: 'addplugin', url: Q('pluginurlinput').value}); diff --git a/views/default.handlebars b/views/default.handlebars index 7d427bbc..f649d130 100644 --- a/views/default.handlebars +++ b/views/default.handlebars @@ -4581,7 +4581,11 @@ p13clearConsoleMsg(); // Device refresh plugin handler - if (pluginHandler != null) { pluginHandler.callHook('onDeviceRefreshEnd', nodeid, panel, refresh, event); } + if (pluginHandler != null) { + pluginHandler.callHook('onDeviceRefreshEnd', nodeid, panel, refresh, event); + var lastTab = getstore('_curPluginPage', null); + if (lastTab != null) pluginHandler.callPluginPage(lastTab, Q('p19ph-' + lastTab)); + } } setupDesktop(); // Always refresh the desktop, even if we are on the same device, we need to do some canvas switching. if (!panel) panel = 10;