[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/media/com_installer/js/ -> changelog.js (source)

   1  /**
   2   * @copyright   (C) 2019 Open Source Matters, Inc. <https://www.joomla.org>
   3   * @license     GNU General Public License version 2 or later; see LICENSE.txt
   4   */
   5  Joomla = window.Joomla || {};
   6  
   7  (Joomla => {
   8  
   9    document.addEventListener('DOMContentLoaded', () => {
  10      const modals = document.getElementsByClassName('changelogModal');
  11      Array.from(modals).forEach(element => {
  12        element.addEventListener('click', modal => {
  13          Joomla.loadChangelog(modal.target.dataset.jsExtensionid, modal.target.dataset.jsView);
  14        });
  15      });
  16    });
  17    /**
  18     * Load the changelog data
  19     *
  20     * @param extensionId The extension ID to load the changelog for
  21     * @param view The view the changelog is for,
  22     *             this is used to determine which version number to show
  23     *
  24     * @since   4.0.0
  25     */
  26  
  27    Joomla.loadChangelog = (extensionId, view) => {
  28      const modal = document.querySelector(`#changelogModal$extensionId} .modal-body`);
  29      Joomla.request({
  30        url: `index.php?option=com_installer&task=manage.loadChangelog&eid=$extensionId}&source=$view}&format=json`,
  31        onSuccess: response => {
  32          let message = '';
  33  
  34          try {
  35            const result = JSON.parse(response);
  36  
  37            if (result.error) {
  38              [message] = result;
  39            } else {
  40              message = result.data;
  41            }
  42          } catch (exception) {
  43            message = exception;
  44          }
  45  
  46          modal.innerHTML = Joomla.sanitizeHtml(message);
  47        },
  48        onError: function onError(xhr) {
  49          modal.innerHTML = Joomla.sanitizeHtml(xhr.statusText);
  50        }
  51      });
  52    };
  53  })(Joomla);


Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer