diff --git a/kefinTweaks-plugin.js b/kefinTweaks-plugin.js index f48813e..8496f55 100644 --- a/kefinTweaks-plugin.js +++ b/kefinTweaks-plugin.js @@ -476,22 +476,50 @@ window.KefinTweaksConfig = ${JSON.stringify(config, null, 2)};`; const content = document.createElement('div'); content.style.display = 'flex'; content.style.flexDirection = 'column'; - content.style.gap = '1em'; content.style.lineHeight = '1.6'; if (isInitialInstall) { // Initial installation message with support information content.innerHTML = ` -
Thanks for installing KefinTweaks.
-KefinTweaks is not maintained by the Jellyfin team, and as a result you are encouraged to seek support from me directly. Sadly, there is no place suitable for discussion of plugins built by community members or fan-made projects in the official Jellyfin Discord, so please visit the Jellyfin Community Discord to find me (username: HighImKevin) and other users who would be happy to help you out. Please also feel free to report bugs and request features from the Issues page. The strength of this plugin relies on awesome community members like you, so thanks for using KefinTweaks!
+Thanks so much for installing KefinTweaks!
+KefinTweaks is not maintained by the Jellyfin team, and as a result you are encouraged to seek support from me directly.
+Sadly, there is currently no place suitable for discussion of plugins built by community members or fan-made projects in the official Jellyfin Discord, so please visit the Jellyfin Community Discord to find me (username: HighImKevin) and other users who would be happy to help you out.
+Please also feel free to report bugs and request features from the Issues page. The strength of this plugin relies on awesome community members like you, so thanks for using KefinTweaks!
`; } else { // Update message with refresh instruction content.innerHTML = ` -KefinTweaks ${version} has been installed. Please refresh your page for the changes to take effect!
+KefinTweaks configuration has been successfully updated. Please refresh your page for the changes to take effect!
`; } + // Add discord icon link to the bottom of the content use a background img on an element + const kefinRoot = window.KefinTweaksConfig?.kefinTweaksRoot; + + if (kefinRoot) { + // Wrapped in a link to the discord server + const discordLinkWrapper = document.createElement('div'); + discordLinkWrapper.style.display = 'flex'; + discordLinkWrapper.style.justifyContent = 'center'; + + const discordLink = document.createElement('a'); + discordLink.href = 'https://discord.gg/v7P9CAvCKZ'; + discordLink.target = '_blank'; + discordLink.style.display = 'inline-block'; + discordLink.style.width = '50px'; + + + const discordIcon = document.createElement('div'); + discordIcon.style.backgroundImage = `url(${kefinRoot}/pages/images/discord.png)`; + discordIcon.style.backgroundSize = 'contain'; + discordIcon.style.backgroundPosition = 'center'; + discordIcon.style.backgroundRepeat = 'no-repeat'; + discordIcon.style.height = '35px'; + discordLink.appendChild(discordIcon); + discordLinkWrapper.appendChild(discordLink); + content.appendChild(discordLinkWrapper); + } + const footer = document.createElement('div'); footer.style.display = 'flex'; footer.style.justifyContent = 'flex-end'; @@ -510,7 +538,7 @@ window.KefinTweaksConfig = ${JSON.stringify(config, null, 2)};`; footer.appendChild(okBtn); - createSimpleModal(SUCCESS_MODAL_ID, 'KefinTweaks', content, footer); + createSimpleModal(SUCCESS_MODAL_ID, `${isInitialInstall ? 'Plugin Installed' : 'Plugin Updated'}`, content, footer); } // Open source configuration modal @@ -531,6 +559,42 @@ window.KefinTweaksConfig = ${JSON.stringify(config, null, 2)};`; content.style.flexDirection = 'column'; content.style.gap = '1.5em'; + // Enabled checkbox + const isEnabled = currentConfig?.enabled !== false; + const enabledContainer = document.createElement('div'); + enabledContainer.style.display = 'flex'; + enabledContainer.style.alignItems = 'center'; + enabledContainer.style.gap = '0.75em'; + + const enabledCheckbox = document.createElement('input'); + enabledCheckbox.type = 'checkbox'; + enabledCheckbox.id = 'kefinTweaksEnabledModal'; + enabledCheckbox.className = 'checkbox'; + enabledCheckbox.checked = isEnabled; + + const enabledLabel = document.createElement('label'); + enabledLabel.setAttribute('for', 'kefinTweaksEnabledModal'); + enabledLabel.style.cursor = 'pointer'; + enabledLabel.style.margin = '0'; + enabledLabel.style.display = 'flex'; + enabledLabel.style.alignItems = 'center'; + enabledLabel.style.gap = '0.75em'; + + const enabledText = document.createElement('span'); + enabledText.textContent = isEnabled ? 'Enabled' : 'Disabled'; + enabledText.id = 'kefinTweaksEnabledModalLabel'; + + enabledLabel.appendChild(enabledCheckbox); + enabledLabel.appendChild(enabledText); + enabledContainer.appendChild(enabledLabel); + + // Update label text when checkbox changes + enabledCheckbox.addEventListener('change', () => { + enabledText.textContent = enabledCheckbox.checked ? 'Enabled' : 'Disabled'; + }); + + content.appendChild(enabledContainer); + // Source Type dropdown const sourceTypeLabel = document.createElement('label'); sourceTypeLabel.textContent = 'Source Type:'; @@ -643,12 +707,16 @@ window.KefinTweaksConfig = ${JSON.stringify(config, null, 2)};`; }; } + // Get enabled state from checkbox + const enabledState = enabledCheckbox.checked; + // Merge with existing config to preserve user settings const mergedConfig = { ...defaultConfig, kefinTweaksRoot: kefinTweaksRoot, ...(currentConfig || {}), - kefinTweaksRoot: kefinTweaksRoot // Ensure root is updated + kefinTweaksRoot: kefinTweaksRoot, // Ensure root is updated + enabled: enabledState // Update enabled state }; // Remove scriptRoot if it exists (legacy field) @@ -660,6 +728,7 @@ window.KefinTweaksConfig = ${JSON.stringify(config, null, 2)};`; // Update window.KefinTweaksConfig immediately so injector can use it window.KefinTweaksConfig = mergedConfig; + window.KefinTweaksConfigEnabled = enabledState; closeSimpleModal(MODAL_ID); @@ -746,7 +815,7 @@ window.KefinTweaksConfig = ${JSON.stringify(config, null, 2)};`; footer.appendChild(cancelBtn); footer.appendChild(uninstallBtn); - createSimpleModal(MODAL_ID, 'Configure KefinTweaks Source', content, footer); + createSimpleModal(MODAL_ID, 'KefinTweaks Plugin Settings', content, footer); } /** diff --git a/pages/images/discord.png b/pages/images/discord.png new file mode 100644 index 0000000..c49cc20 Binary files /dev/null and b/pages/images/discord.png differ diff --git a/scripts/configuration.js b/scripts/configuration.js index c331b4d..8fd6584 100644 --- a/scripts/configuration.js +++ b/scripts/configuration.js @@ -361,53 +361,6 @@ document.head.appendChild(style); } - // Show confirmation modal for editing script root configuration - function showScriptRootEditConfirmation() { - return new Promise((resolve) => { - if (!window.ModalSystem) { - resolve(false); - return; - } - - const modal = window.ModalSystem.create({ - id: 'scriptRootEditConfirmation', - title: 'Edit KefinTweaks Root URL', - content: ` -