Making WordPress.org

Changeset 12790


Ignore:
Timestamp:
08/01/2023 10:50:55 PM (19 months ago)
Author:
coffee2code
Message:

Photo Directory, Admin CSS/JS: Highlight photo post description textarea if empty.

See #7171.

Location:
sites/trunk/wordpress.org/public_html/wp-content/plugins/photo-directory/assets
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/photo-directory/assets/css/admin.css

    r12781 r12790  
    6161}
    6262
     63#content.photo-missing-description,
    6364.photo-missing-taxonomy {
    64     border-color: orange;
     65    border: 1px solid orange;
    6566    background-color: antiquewhite;
    6667}
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/photo-directory/assets/js/admin.js

    r12784 r12790  
    3434    ];
    3535    interfaceElementsToRemove.forEach(n => { document.querySelector(n)?.remove(); });
     36
     37    // Highlight photo description/caption if empty.
     38    const photoDescription = document.getElementById('content');
     39    function setDescriptionHighlight() {
     40        const missingDescription = 'photo-missing-description';
     41        if ( photoDescription?.value.trim().length > 0 ) {
     42            photoDescription.classList.remove(missingDescription);
     43        } else {
     44            photoDescription.classList.add(missingDescription);
     45        }
     46    }
     47    setDescriptionHighlight();
     48    photoDescription.addEventListener('input', e => setDescriptionHighlight());
    3649
    3750    // Highlight custom taxonomies lacking terms.
Note: See TracChangeset for help on using the changeset viewer.