From 161e16d25cebcff79012554493d382996f04dc19 Mon Sep 17 00:00:00 2001 From: hadihakim Date: Fri, 28 Apr 2023 17:57:21 +0300 Subject: [PATCH] update plugin instance title to navigate to --- control/content/index.html | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/control/content/index.html b/control/content/index.html index d9fd31f..4d5e244 100755 --- a/control/content/index.html +++ b/control/content/index.html @@ -350,8 +350,14 @@ if (result && Object.keys(config.pluginData).length > 0) { - pluginInstanceName.innerHTML = config.pluginData.pluginTypeName + ': ' + config.pluginData.title; - queryStringContainer.style.display = "grid" + getPluginInstance(config.pluginData.instanceId).then(pluginInstance => { + if(pluginInstance && pluginInstance.title !== config.pluginData.title) { + config.pluginData.title = pluginInstance.title; + config.save(); + } + pluginInstanceName.innerHTML = config.pluginData.pluginTypeName + ': ' + config.pluginData.title; + queryStringContainer.style.display = "grid" + }); } else { pluginInstanceName.innerHTML = 'Social Wall' queryStringContainer.style.display = "none" @@ -412,6 +418,19 @@ }) } + function getPluginInstance (instanceId) { + return new Promise((resolve, reject) => { + if(!instanceId) resolve(null); + buildfire.pluginInstance.get(instanceId, function(error, instance) { + if (instance) { + resolve(instance); + } else { + resolve(null); + } + }); + }); + } + function setBothPrivacyElements() { let elements = document.getElementsByClassName("tagInputContainer"); if (config.writePrivacy === Config.WRITE_PRIVACY.PRIVATE) {