Plugin Directory

Changeset 2876240


Ignore:
Timestamp:
03/08/2023 02:53:38 AM (3 years ago)
Author:
minegapai
Message:

1.0.6 Release

Location:
alttextmagic
Files:
27 added
3 edited

Legend:

Unmodified
Added
Removed
  • alttextmagic/trunk/js/media.js

    r2867879 r2876240  
    4242}
    4343
    44 function addUploadAltTextMagicButtonToModal(wpAltTextDescriptionId, postID, altTextMagicElementId, altTextMagicTextElementClass) {
     44function addUploadAltTextMagicButtonToModal(wpAltTextDescriptionId, postID, altTextMagicElementId) {
    4545    let altTextDescription = document.getElementById(wpAltTextDescriptionId);
    4646    // Remove any existing added elements. There should only be one at a time.
     
    5151
    5252    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);
    5454        altTextDescription.appendChild(altTextMagicButton);
    5555        return true;
     
    8888}
    8989
    90 function createAltTextMagicButton(altTextInput, postID, altTextMagicElementId, altTextMagicTextElementClass) {
     90function createAltTextMagicButton(altTextInput, postID, altTextMagicElementId) {
    9191    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");
    9393    altTextMagicButton.style.display = "inline-flex";
    9494    altTextMagicButton.style.alignItems = "center";
     
    100100    altTextMagicIcon.style.marginRight = "4px";
    101101    let altTextMagicButtonText = document.createElement("span");
    102     altTextMagicButtonText.classList.add(altTextMagicTextElementClass);
    103102    altTextMagicButtonText.innerText = "Update Alt Text";
    104103    altTextMagicButton.appendChild(altTextMagicIcon);
     
    135134document.addEventListener('DOMContentLoaded', async (e) => {
    136135    let altTextMagicElementId = "alt-text-magic-alt-add-alt-text";
    137     let altTextMagicTextElementClass = "alt-text-magic-button-text";
    138136    let wpAltTextDescriptionId = "alt-text-description";
    139137
     
    157155
    158156        if (altTextDescription) {
    159             let altTextMagicButton = createAltTextMagicButton(document.getElementById('attachment_alt'), postID, altTextMagicElementId, altTextMagicTextElementClass);
     157            let altTextMagicButton = createAltTextMagicButton(document.getElementById('attachment_alt'), postID, altTextMagicElementId);
    160158            altTextDescription.appendChild(altTextMagicButton);
    161159        }
     
    181179                    return;
    182180                }
    183                 let added = addUploadAltTextMagicButtonToModal(wpAltTextDescriptionId, postID, altTextMagicElementId, altTextMagicTextElementClass);
     181                let added = addUploadAltTextMagicButtonToModal(wpAltTextDescriptionId, postID, altTextMagicElementId);
    184182                if (added) {
    185183                    clearInterval(interval);
     
    187185            }, 500);
    188186        }
     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        });
    189221
    190222        jQuery('body').on('click', 'ul.attachments li.attachment', function () {
     
    201233                return;
    202234            }
    203             addUploadAltTextMagicButtonToModal(wpAltTextDescriptionId, postID, altTextMagicElementId, altTextMagicTextElementClass);
     235            addUploadAltTextMagicButtonToModal(wpAltTextDescriptionId, postID, altTextMagicElementId);
    204236        });
    205237    }
  • alttextmagic/trunk/plugin.php

    r2867879 r2876240  
    55 * Plugin URI: https://alttextmagic.com/
    66 * Description: Automatically generates descriptive alternative text for images upon upload.
    7  * Version: 1.0.5
     7 * Version: 1.0.6
    88 * Requires at least: 4.2.0
    99 * Requires PHP: 7.2
     
    372372
    373373    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
    375380        wp_enqueue_script('alt_text_magic_js', plugins_url('/js/media.js', __FILE__));
    376381        alt_text_magic_add_nonces();
  • alttextmagic/trunk/readme.txt

    r2867879 r2876240  
    55Requires at least: 4.2
    66Tested up to: 6.1.1
    7 Stable tag: 1.0.5
     7Stable tag: 1.0.6
    88Requires PHP: 7.0
    99License: GPLv3 or later
     
    7575
    7676== 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
    7781= 1.0.5 =
    7882* 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.