Guest User

Untitled

a guest
Jul 12th, 2025
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Auto-fill form function
  2. function autoFillForm() {
  3.     showWarning('Check all short captions!\nLong captions are cut off by […]');
  4.  
  5.     const photoBlocks = document.querySelectorAll('.photo');
  6.     photoBlocks.forEach(block => {
  7.         const photoId = getPhotoIdFromBlock(block);
  8.         if (!photoId) return;
  9.  
  10.         const title = block.querySelector('.flickr_info dt:nth-child(3) + dd')?.textContent.trim();
  11.         const description = block.querySelector('.flickr_info dt:nth-child(5) + dd')?.textContent.trim();
  12.  
  13.         const titleInput = block.querySelector(`#photo_${photoId}-title`);
  14.         const descInput = block.querySelector(`#photo_${photoId}-short_caption`);
  15.  
  16.         if (titleInput && title) {
  17.             // The title value is now the original title plus the photo ID in parenthesis.
  18.             titleInput.value = `${title} (${photoId})`;
  19.         }
  20.         if (descInput && description) {
  21.             descInput.value = description;
  22.         }
  23.     });
  24. }
Advertisement
Add Comment
Please, Sign In to add comment