Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Auto-fill form function
- function autoFillForm() {
- showWarning('Check all short captions!\nLong captions are cut off by […]');
- const photoBlocks = document.querySelectorAll('.photo');
- photoBlocks.forEach(block => {
- const photoId = getPhotoIdFromBlock(block);
- if (!photoId) return;
- const title = block.querySelector('.flickr_info dt:nth-child(3) + dd')?.textContent.trim();
- const description = block.querySelector('.flickr_info dt:nth-child(5) + dd')?.textContent.trim();
- const titleInput = block.querySelector(`#photo_${photoId}-title`);
- const descInput = block.querySelector(`#photo_${photoId}-short_caption`);
- if (titleInput && title) {
- // The title value is now the original title plus the photo ID in parenthesis.
- titleInput.value = `${title} (${photoId})`;
- }
- if (descInput && description) {
- descInput.value = description;
- }
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment