+ Your current configuration is shown below as JSON. Select and copy this text to back up or share your configuration.
+ ${canUseClipboard ? '' : ' Clipboard access is not available on this connection, so manual copying is required.'}
+
+
+ `,
+ footer: `
+ ${
+ canUseClipboard
+ ? `
+
+ `
+ : ''
+ }
+
+ `,
+ closeOnBackdrop: true,
+ closeOnEscape: true,
+ onOpen: (modalInstance) => {
+ const textarea = modalInstance.dialogContent.querySelector('#exportConfigTextarea');
+ if (textarea) {
+ textarea.value = configJson;
+ // Select text to make manual copying easier
+ setTimeout(() => {
+ textarea.focus();
+ textarea.select();
+ }, 100);
+ }
+
+ const closeBtn = modalInstance.dialogFooter?.querySelector('#closeExportConfigBtn');
+ if (closeBtn) {
+ closeBtn.addEventListener('click', () => modalInstance.close());
+ }
+
+ if (canUseClipboard) {
+ const copyBtn = modalInstance.dialogFooter?.querySelector('#copyExportConfigBtn');
+ if (copyBtn) {
+ copyBtn.addEventListener('click', async () => {
+ try {
+ await navigator.clipboard.writeText(configJson);
+ if (window.KefinTweaksToaster && window.KefinTweaksToaster.toast) {
+ window.KefinTweaksToaster.toast('Configuration copied to clipboard!');
+ } else {
+ alert('Configuration copied to clipboard!');
+ }
+ } catch (copyError) {
+ console.error(
+ '[KefinTweaks Configuration] Error copying config to clipboard:',
+ copyError
+ );
+ if (window.KefinTweaksToaster && window.KefinTweaksToaster.toast) {
+ window.KefinTweaksToaster.toast(
+ 'Error copying configuration to clipboard',
+ '5'
+ );
+ } else {
+ alert('Error copying configuration to clipboard');
+ }
+ }
+ });
+ }
+ }
+ }
+ });
+ } else if (navigator.clipboard && navigator.clipboard.writeText) {
+ // Fallback: no modal system, but clipboard is available
+ await navigator.clipboard.writeText(configJson);
+
+ if (window.KefinTweaksToaster && window.KefinTweaksToaster.toast) {
+ window.KefinTweaksToaster.toast('Configuration exported to clipboard!');
+ } else {
+ alert('Configuration exported to clipboard!');
+ }
} else {
- alert('Configuration exported to clipboard!');
+ // Last-resort fallback: log to console
+ console.log('[KefinTweaks Configuration] Exported configuration:', configJson);
+ if (window.KefinTweaksToaster && window.KefinTweaksToaster.toast) {
+ window.KefinTweaksToaster.toast(
+ 'Unable to open export modal or access clipboard; configuration logged to console',
+ '3'
+ );
+ } else {
+ alert(
+ 'Unable to open export modal or access clipboard. Check the browser console for the exported configuration.'
+ );
+ }
}
} catch (error) {
console.error('[KefinTweaks Configuration] Error exporting config:', error);
-
if (window.KefinTweaksToaster && window.KefinTweaksToaster.toast) {
- window.KefinTweaksToaster.toast('Error exporting configuration to clipboard', '5');
+ window.KefinTweaksToaster.toast('Error exporting configuration', '5');
} else {
- alert('Error exporting configuration to clipboard');
+ alert('Error exporting configuration');
}
}
}