Changeset 2876240
- Timestamp:
- 03/08/2023 02:53:38 AM (3 years ago)
- Location:
- alttextmagic
- Files:
-
- 27 added
- 3 edited
-
tags/1.0.6 (added)
-
tags/1.0.6/assets (added)
-
tags/1.0.6/assets/Alt-Text-Magic-logo.png (added)
-
tags/1.0.6/assets/chicken-icon-gr.png (added)
-
tags/1.0.6/assets/chicken-icon.png (added)
-
tags/1.0.6/css (added)
-
tags/1.0.6/css/atm-global.css (added)
-
tags/1.0.6/css/media.css (added)
-
tags/1.0.6/css/toastify.css (added)
-
tags/1.0.6/data (added)
-
tags/1.0.6/data/cacert.pem (added)
-
tags/1.0.6/includes (added)
-
tags/1.0.6/includes/account.php (added)
-
tags/1.0.6/includes/dashboard.php (added)
-
tags/1.0.6/includes/library_updater.php (added)
-
tags/1.0.6/js (added)
-
tags/1.0.6/js/account.js (added)
-
tags/1.0.6/js/alt_text_magic_utils.js (added)
-
tags/1.0.6/js/dashboard.js (added)
-
tags/1.0.6/js/library_updater.js (added)
-
tags/1.0.6/js/media.js (added)
-
tags/1.0.6/js/toastify.js (added)
-
tags/1.0.6/license.txt (added)
-
tags/1.0.6/plugin.php (added)
-
tags/1.0.6/readme.txt (added)
-
tags/1.0.6/uninstall.php (added)
-
trunk/css/media.css (added)
-
trunk/js/media.js (modified) (9 diffs)
-
trunk/plugin.php (modified) (2 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
alttextmagic/trunk/js/media.js
r2867879 r2876240 42 42 } 43 43 44 function addUploadAltTextMagicButtonToModal(wpAltTextDescriptionId, postID, altTextMagicElementId , altTextMagicTextElementClass) {44 function addUploadAltTextMagicButtonToModal(wpAltTextDescriptionId, postID, altTextMagicElementId) { 45 45 let altTextDescription = document.getElementById(wpAltTextDescriptionId); 46 46 // Remove any existing added elements. There should only be one at a time. … … 51 51 52 52 if (altTextDescription) { 53 let altTextMagicButton = createAltTextMagicButton(document.getElementById('attachment-details-two-column-alt-text'), postID, altTextMagicElementId , altTextMagicTextElementClass);53 let altTextMagicButton = createAltTextMagicButton(document.getElementById('attachment-details-two-column-alt-text'), postID, altTextMagicElementId); 54 54 altTextDescription.appendChild(altTextMagicButton); 55 55 return true; … … 88 88 } 89 89 90 function createAltTextMagicButton(altTextInput, postID, altTextMagicElementId , altTextMagicTextElementClass) {90 function createAltTextMagicButton(altTextInput, postID, altTextMagicElementId) { 91 91 let altTextMagicButton = document.createElement("button"); 92 altTextMagicButton.classList.add(" nav-link", "outline-btn", "no-text-decoration", "media-change-alt-text-btn");92 altTextMagicButton.classList.add("alt-text-magic-nav-link", "alt-text-magic-outline-btn", "alt-text-magic-no-text-decoration", "alt-text-magic-media-change-alt-text-btn"); 93 93 altTextMagicButton.style.display = "inline-flex"; 94 94 altTextMagicButton.style.alignItems = "center"; … … 100 100 altTextMagicIcon.style.marginRight = "4px"; 101 101 let altTextMagicButtonText = document.createElement("span"); 102 altTextMagicButtonText.classList.add(altTextMagicTextElementClass);103 102 altTextMagicButtonText.innerText = "Update Alt Text"; 104 103 altTextMagicButton.appendChild(altTextMagicIcon); … … 135 134 document.addEventListener('DOMContentLoaded', async (e) => { 136 135 let altTextMagicElementId = "alt-text-magic-alt-add-alt-text"; 137 let altTextMagicTextElementClass = "alt-text-magic-button-text";138 136 let wpAltTextDescriptionId = "alt-text-description"; 139 137 … … 157 155 158 156 if (altTextDescription) { 159 let altTextMagicButton = createAltTextMagicButton(document.getElementById('attachment_alt'), postID, altTextMagicElementId , altTextMagicTextElementClass);157 let altTextMagicButton = createAltTextMagicButton(document.getElementById('attachment_alt'), postID, altTextMagicElementId); 160 158 altTextDescription.appendChild(altTextMagicButton); 161 159 } … … 181 179 return; 182 180 } 183 let added = addUploadAltTextMagicButtonToModal(wpAltTextDescriptionId, postID, altTextMagicElementId , altTextMagicTextElementClass);181 let added = addUploadAltTextMagicButtonToModal(wpAltTextDescriptionId, postID, altTextMagicElementId); 184 182 if (added) { 185 183 clearInterval(interval); … … 187 185 }, 500); 188 186 } 187 188 jQuery('body').on('click', '.left.dashicons', function () { 189 let queryStringItem = getQueryStringParam('item'); 190 /** 191 * The modal is open on page load as there is a query string param 'item'. 192 * Add the button to the modal. 193 */ 194 if (queryStringItem) { 195 let postID = parseInt(queryStringItem, 10); 196 // Could not be parsed into an integer, return. 197 if (!postID) { 198 return; 199 } 200 201 addUploadAltTextMagicButtonToModal(wpAltTextDescriptionId, postID, altTextMagicElementId); 202 } 203 }); 204 205 jQuery('body').on('click', '.right.dashicons', function () { 206 let queryStringItem = getQueryStringParam('item'); 207 /** 208 * The modal is open on page load as there is a query string param 'item'. 209 * Add the button to the modal. 210 */ 211 if (queryStringItem) { 212 let postID = parseInt(queryStringItem, 10); 213 // Could not be parsed into an integer, return. 214 if (!postID) { 215 return; 216 } 217 218 addUploadAltTextMagicButtonToModal(wpAltTextDescriptionId, postID, altTextMagicElementId); 219 } 220 }); 189 221 190 222 jQuery('body').on('click', 'ul.attachments li.attachment', function () { … … 201 233 return; 202 234 } 203 addUploadAltTextMagicButtonToModal(wpAltTextDescriptionId, postID, altTextMagicElementId , altTextMagicTextElementClass);235 addUploadAltTextMagicButtonToModal(wpAltTextDescriptionId, postID, altTextMagicElementId); 204 236 }); 205 237 } -
alttextmagic/trunk/plugin.php
r2867879 r2876240 5 5 * Plugin URI: https://alttextmagic.com/ 6 6 * Description: Automatically generates descriptive alternative text for images upon upload. 7 * Version: 1.0. 57 * Version: 1.0.6 8 8 * Requires at least: 4.2.0 9 9 * Requires PHP: 7.2 … … 372 372 373 373 if ($pagenow == 'upload.php' || $pagenow == 'post.php') { 374 alt_text_magic_enqueue_libraries(); 374 wp_enqueue_style('toast', plugins_url('css/toastify.css', __FILE__)); 375 wp_enqueue_script('toast', plugins_url('js/toastify.js', __FILE__)); 376 wp_enqueue_script('alt_text_magic_utils_js', plugins_url('js/alt_text_magic_utils.js', __FILE__)); 377 // Use media.css instead of global.css as it is not an Alt Text Magic page. 378 wp_enqueue_style('alt_text_magic_css', plugins_url('/css/media.css', __FILE__)); 379 375 380 wp_enqueue_script('alt_text_magic_js', plugins_url('/js/media.js', __FILE__)); 376 381 alt_text_magic_add_nonces(); -
alttextmagic/trunk/readme.txt
r2867879 r2876240 5 5 Requires at least: 4.2 6 6 Tested up to: 6.1.1 7 Stable tag: 1.0. 57 Stable tag: 1.0.6 8 8 Requires PHP: 7.0 9 9 License: GPLv3 or later … … 75 75 76 76 == Changelog == 77 = 1.0.6 = 78 * Fixed an issue where left and right navigation on the media page would not show the update alt text button correctly. 79 * Added a small version of the css file to avoid global conflicts on the media page. 80 77 81 = 1.0.5 = 78 82 * Added a button to update alt text in the attachment details modal in the media library.
Note: See TracChangeset
for help on using the changeset viewer.