MCPcopy Create free account
hub / github.com/MemeTray/MemeTray / removeSelectedFiles

Function removeSelectedFiles

tools/all-in-one/script.js:921–956  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

919}
920
921async function removeSelectedFiles() {
922 if (state.selectedFiles.size === 0) {
923 return;
924 }
925
926 const selectedArray = Array.from(state.selectedFiles).sort((a, b) => b - a);
927 selectedArray.forEach(index => {
928 state.finalFiles.splice(index, 1);
929 });
930
931 state.selectedFiles.clear();
932
933 // Recalculate numbering for remaining files when auto-rename is enabled
934 if (state.settings.autoRename && state.finalFiles.length > 0) {
935 showProgress('Renumbering files...', 0);
936 const startNum = parseInt(elements.startNumber.value) || 1;
937 const suffix = elements.suffix.value.trim() || 'meme';
938
939 for (let i = 0; i < state.finalFiles.length; i++) {
940 const file = state.finalFiles[i];
941 const newNumber = startNum + i;
942 const paddedNum = String(newNumber).padStart(4, '0');
943 const newName = `${paddedNum}_${suffix}.gif`;
944
945 state.finalFiles[i] = {
946 ...file,
947 renamedFile: new File([file.compressedFile], newName, { type: 'image/gif' }),
948 newName: newName
949 };
950 }
951
952 hideProgress();
953 }
954
955 displayResults();
956}
957
958function updateSelectionState() {
959 const items = document.querySelectorAll('.results-item');

Callers

nothing calls this directly

Calls 3

showProgressFunction · 0.85
hideProgressFunction · 0.85
displayResultsFunction · 0.70

Tested by

no test coverage detected