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

Function addPreviewButtonToRenameStep

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

Source from the content-addressed store, hash-verified

1127
1128// Inject a preview toggle button during the rename step
1129function addPreviewButtonToRenameStep() {
1130 // Avoid creating duplicate preview buttons
1131 const existingPreviewBtn = document.getElementById('previewToggleBtn');
1132 if (existingPreviewBtn) {
1133 return;
1134 }
1135
1136 // Create the preview button
1137 const previewBtn = document.createElement('button');
1138 previewBtn.id = 'previewToggleBtn';
1139 previewBtn.className = 'btn btn-secondary';
1140 previewBtn.innerHTML = `
1141 <svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor" stroke-width="2">
1142 <path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"></path>
1143 <circle cx="12" cy="12" r="3"></circle>
1144 </svg>
1145 Preview GIFs
1146 `;
1147 previewBtn.addEventListener('click', () => {
1148 if (memeTrayUI && memeTrayUI.preview) {
1149 memeTrayUI.preview.toggle();
1150 }
1151 });
1152
1153 // Insert it into the action button group
1154 const actionGroup = document.querySelector('.action-group');
1155 if (actionGroup) {
1156 actionGroup.insertBefore(previewBtn, actionGroup.firstChild);
1157 }
1158}
1159
1160// Format a file size value
1161function formatFileSize(bytes) {

Callers 1

displayResultsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected