From d86df6a07b93a4078a1e5cbe1d56cb4a2ad708db Mon Sep 17 00:00:00 2001 From: Ben Morton Date: Tue, 22 Apr 2025 20:51:58 +0100 Subject: [PATCH 1/7] [582724](UserStory) Add a plugin to hide the version up button in the Flix Panel Browser --- client_plugins/version_up_away/main.js | 57 ++++++++++++++++++++ client_plugins/version_up_away/manifest.json | 12 +++++ 2 files changed, 69 insertions(+) create mode 100644 client_plugins/version_up_away/main.js create mode 100644 client_plugins/version_up_away/manifest.json diff --git a/client_plugins/version_up_away/main.js b/client_plugins/version_up_away/main.js new file mode 100644 index 0000000..488ebc4 --- /dev/null +++ b/client_plugins/version_up_away/main.js @@ -0,0 +1,57 @@ +/** + * Handles mutation observer events. Filters events down to DOM modification that impact the version up button, and hides it if it is visible. + */ +const onDomChange = (mutations) => { + for (const mutation of mutations) { + // If not an element added/remove, skip this event. + if (mutation.type !== 'childList') { + continue; + } + + const targetElement = mutation.target; + // If not the version up button, skip this event. + if (targetElement.id !== "versionUp") { + continue; + } + + // If the version up button is already hidden, stop processing events. + if (targetElement.style.display === 'none') { + break; + } + + // Otherwise, hide the version up button and stop processing events. + console.log("Hiding Version Up button in the Panel Browser."); + targetElement.style.display = 'none'; + break; + } +}; + +// Mutation observer is used to monitor changes to DOM elements to hide the version up button when it is added. +const observer = new MutationObserver(onDomChange); + +// Flag to determine whether DOM changes are currently being observed. +let observing = false; + +// Navigation API is used to monitor navigating to the panel browser to start watching DOM modifications. +navigation.addEventListener("navigate", event => { + if (event.destination.url.endsWith("/workspace")) { + // When in the panel browser, start watching DOM changes to hide the version up button + console.log("Detected Flix workspace, listening for DOM changes."); + + observer.observe(document.body, { subtree: true, childList: true }); + observing = true; + + // If the version up button is already present in the DOM, hide it now + const versionUpElement = document.querySelector("#versionUp"); + if (versionUpElement) { + console.log("Hiding Version Up button in the Panel Browser."); + versionUpElement.style.display = 'none'; + } + } else if (observing) { + // When leaving the panel browser, stop monitoring DOM changes so it doesn't impact performance + console.log("Left Flix workspace, stopped listening to DOM changes."); + + observer.disconnect(); + observing = false; + } +}); \ No newline at end of file diff --git a/client_plugins/version_up_away/manifest.json b/client_plugins/version_up_away/manifest.json new file mode 100644 index 0000000..2b63809 --- /dev/null +++ b/client_plugins/version_up_away/manifest.json @@ -0,0 +1,12 @@ +{ + "name": "Version Up Away", + "version": "1.0", + "description": "A simple plugin that removes the 'Version Up' button from the Flix Panel Browser.", + "content_scripts": [ + { + "matches": ["file://*"], + "js": ["main.js"] + } + ], + "manifest_version": 3 + } \ No newline at end of file From c8d999b97f435cfdd9b93f15d2e7f27805edc814 Mon Sep 17 00:00:00 2001 From: Ben Morton Date: Thu, 24 Apr 2025 15:33:16 +0100 Subject: [PATCH 2/7] [582724](UserStory) Add license header to the version up away plugin --- client_plugins/version_up_away/main.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/client_plugins/version_up_away/main.js b/client_plugins/version_up_away/main.js index 488ebc4..71d995f 100644 --- a/client_plugins/version_up_away/main.js +++ b/client_plugins/version_up_away/main.js @@ -1,3 +1,7 @@ +/** + * Copyright (c) 2025 The Foundry Visionmongers Ltd. All Rights Reserved. + */ + /** * Handles mutation observer events. Filters events down to DOM modification that impact the version up button, and hides it if it is visible. */ From f4d5d68901779963b6152d14e7d5bcaea630148d Mon Sep 17 00:00:00 2001 From: Shiva Date: Mon, 28 Apr 2025 15:33:35 +0100 Subject: [PATCH 3/7] [develop][582598](UserStory) Added populate custom hostname plugin files --- .../default_hostname_setter/main.js | 27 +++++++++++++++++++ .../default_hostname_setter/manifest.json | 13 +++++++++ 2 files changed, 40 insertions(+) create mode 100644 client_plugins/default_hostname_setter/main.js create mode 100644 client_plugins/default_hostname_setter/manifest.json diff --git a/client_plugins/default_hostname_setter/main.js b/client_plugins/default_hostname_setter/main.js new file mode 100644 index 0000000..343729e --- /dev/null +++ b/client_plugins/default_hostname_setter/main.js @@ -0,0 +1,27 @@ +/** + * Copyright (c) 2025 The Foundry Visionmongers Ltd. All Rights Reserved. + * This plugin will only work on Flix Client <= 8.0.0.Beta + */ +function setDefaultHostname() { + if (!window.location.pathname.includes('login')) { + return; + } + + const hostInput = document.querySelector('input[name="host"]'); + if (!hostInput) { + console.warn('Default Hostname Setter: No input[name="host"] found.'); + return; + } + + if (hostInput.value.trim() === '') { + hostInput.value = 'your-default-hostname.com'; + console.info('Default Hostname Setter: Hostname set.'); + } +} + +if (document.readyState === 'loading') { + document.addEventListener('DOMContentLoaded', setDefaultHostname); +} else { + setDefaultHostname(); +} + diff --git a/client_plugins/default_hostname_setter/manifest.json b/client_plugins/default_hostname_setter/manifest.json new file mode 100644 index 0000000..8930f96 --- /dev/null +++ b/client_plugins/default_hostname_setter/manifest.json @@ -0,0 +1,13 @@ +{ + "name": "Default Hostname Setter", + "version": "1.0", + "description": "Automatically sets a default hostname on the login page.", + "content_scripts": [ + { + "matches": ["file://*"], + "js": ["main.js"], + "run_at": "document_idle" + } + ], + "manifest_version": 3 + } \ No newline at end of file From ad09161947838343b82b4f9b8f953ecd7c3cef43 Mon Sep 17 00:00:00 2001 From: Shiva Date: Mon, 28 Apr 2025 16:14:54 +0100 Subject: [PATCH 4/7] [develop][582598](UserStory Updated plugin description --- client_plugins/default_hostname_setter/manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client_plugins/default_hostname_setter/manifest.json b/client_plugins/default_hostname_setter/manifest.json index 8930f96..c4b593d 100644 --- a/client_plugins/default_hostname_setter/manifest.json +++ b/client_plugins/default_hostname_setter/manifest.json @@ -1,7 +1,7 @@ { "name": "Default Hostname Setter", "version": "1.0", - "description": "Automatically sets a default hostname on the login page.", + "description": "Automatically sets a default hostname on the login page if hostname input value is empty.", "content_scripts": [ { "matches": ["file://*"], From 7f4c9114416c56e0d37367cbf4869b282efa480a Mon Sep 17 00:00:00 2001 From: Shiva Date: Mon, 28 Apr 2025 16:16:21 +0100 Subject: [PATCH 5/7] [develop][582598](UserStory) Added jsdoc and updated pathname to href to fix the bug --- client_plugins/default_hostname_setter/main.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/client_plugins/default_hostname_setter/main.js b/client_plugins/default_hostname_setter/main.js index 343729e..4ba2761 100644 --- a/client_plugins/default_hostname_setter/main.js +++ b/client_plugins/default_hostname_setter/main.js @@ -1,15 +1,16 @@ /** * Copyright (c) 2025 The Foundry Visionmongers Ltd. All Rights Reserved. - * This plugin will only work on Flix Client <= 8.0.0.Beta + * + * Sets the default hostname in the hostname input when on the login page and the input value is empty. */ function setDefaultHostname() { - if (!window.location.pathname.includes('login')) { + if (!window.location.href.includes('login')) { return; } - const hostInput = document.querySelector('input[name="host"]'); + const hostInput = document.querySelector('input#login_hostname'); if (!hostInput) { - console.warn('Default Hostname Setter: No input[name="host"] found.'); + console.warn('Default Hostname Setter: No input#login_hostname found.'); return; } From 32c76ad16bb653be83acd0f05192744f2df84d9e Mon Sep 17 00:00:00 2001 From: Shiva Date: Wed, 30 Apr 2025 11:47:02 +0100 Subject: [PATCH 6/7] [develop][582598](UserStory) PR feedback - updated log line and added a variable --- client_plugins/default_hostname_setter/main.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/client_plugins/default_hostname_setter/main.js b/client_plugins/default_hostname_setter/main.js index 4ba2761..54810b6 100644 --- a/client_plugins/default_hostname_setter/main.js +++ b/client_plugins/default_hostname_setter/main.js @@ -1,3 +1,6 @@ +// Set your default hostname here +const DEFAULT_HOST_NAME = 'your-default-hostname.com' + /** * Copyright (c) 2025 The Foundry Visionmongers Ltd. All Rights Reserved. * @@ -10,12 +13,12 @@ function setDefaultHostname() { const hostInput = document.querySelector('input#login_hostname'); if (!hostInput) { - console.warn('Default Hostname Setter: No input#login_hostname found.'); + console.warn('Default Hostname Setter: No hostname input found found.'); return; } if (hostInput.value.trim() === '') { - hostInput.value = 'your-default-hostname.com'; + hostInput.value = DEFAULT_HOST_NAME; console.info('Default Hostname Setter: Hostname set.'); } } From 605527150cad7b10aad7691e75fea65f6fb67420 Mon Sep 17 00:00:00 2001 From: Shiva Date: Wed, 30 Apr 2025 11:52:44 +0100 Subject: [PATCH 7/7] [develop][582598](UserStory) PR feedback: moved copyright --- client_plugins/default_hostname_setter/main.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/client_plugins/default_hostname_setter/main.js b/client_plugins/default_hostname_setter/main.js index 54810b6..a74b5e3 100644 --- a/client_plugins/default_hostname_setter/main.js +++ b/client_plugins/default_hostname_setter/main.js @@ -1,9 +1,13 @@ -// Set your default hostname here +/** + * Copyright (c) 2025 The Foundry Visionmongers Ltd. All Rights Reserved. + */ + +/** + * Set your default hostname here. + */ const DEFAULT_HOST_NAME = 'your-default-hostname.com' /** - * Copyright (c) 2025 The Foundry Visionmongers Ltd. All Rights Reserved. - * * Sets the default hostname in the hostname input when on the login page and the input value is empty. */ function setDefaultHostname() {