Changeset 12784
- Timestamp:
- 08/01/2023 10:41:25 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/photo-directory/assets/js/admin.js
r12781 r12784 19 19 // Hide 'Orientations' metabox when a value is assigned. 20 20 // Orientation shouldn't need direct assignment or changing, so don't show it (as long as a value was set). 21 const orientation_value = document.querySelector('input[name="tax_input[photo_orientation][]"]:checked' ); 22 if ( orientation_value ) { 23 document.getElementById('photo_orientationdiv').hidden = true; 21 const orientationValue = document.querySelector('input[name="tax_input[photo_orientation][]"]:checked' ); 22 const orientationDiv = document.getElementById('photo_orientationdiv'); 23 if ( orientationValue && orientationDiv ) { 24 orientationDiv.hidden = true; 24 25 } 25 26 … … 60 61 61 62 // The tag list is handled differently. Re-determine as tags are added/removed. 62 if (element[3]) { 63 const tagList = element[3] ? document.querySelector(element[3]) : null; 64 if (tagList) { 63 65 const observer = new MutationObserver(function(mutations_list) { 64 66 mutations_list.forEach(function(mutation) { … … 69 71 }); 70 72 71 observer.observe( document.querySelector(element[3]), { subtree: false, childList: true });73 observer.observe(tagList, { subtree: false, childList: true }); 72 74 } 73 75 }); … … 96 98 // If tagListClass is present, see if it has any values if one not already found. 97 99 if (!value && tagListClass) { 98 value = document.querySelector(tagListClass) .hasChildNodes();100 value = document.querySelector(tagListClass)?.hasChildNodes(); 99 101 } 100 102
Note: See TracChangeset
for help on using the changeset viewer.