MCPcopy Create free account
hub / github.com/SKVNDR/FastDork / getPreferredImportListKey

Function getPreferredImportListKey

Script/FastDork.js:783–812  ·  view source on GitHub ↗
(domainKey = null)

Source from the content-addressed store, hash-verified

781 return resultListOption?.value || options[0]?.value || null;
782 }
783 async function getPreferredImportListKey(domainKey = null) {
784 if (!UI.listTab2) return null;
785
786 if (domainKey) {
787 const storageLookupKey = `tab2Save-${domainKey}`;
788 try {
789 const data = await getStorageData(storageLookupKey);
790 const savedListKey = data[storageLookupKey];
791 if (
792 savedListKey &&
793 Array.from(UI.listTab2.options).some(
794 (option) => option.value === savedListKey
795 )
796 ) {
797 return savedListKey;
798 }
799 } catch (error) {
800 console.warn(
801 `[getPreferredImportListKey] Could not read saved list for ${domainKey}:`,
802 error
803 );
804 }
805 }
806
807 if (UI.listTab2.value && UI.listTab2.value !== "0") {
808 return UI.listTab2.value;
809 }
810
811 return getFirstAvailableImportListKey();
812 }
813 async function selectListAndRefreshTextarea(
814 listKey,
815 {

Callers 1

setupImportButtonFunction · 0.85

Calls 2

getStorageDataFunction · 0.70

Tested by

no test coverage detected