CoreFiles by mySites.guru
jupdatecheck.js52 lines, 1,783 bytes, from Joomla_4.0.0-rc2-Release_Candidate-Full_Package.zip
Raw History Compare with 4.0.0-rc1
md5
501479fc9fb6cd590b8cca8d9efffa5a
sha1
db7330e0f6dd8b54e2e6d78e894b4fe699d08532
sha256
0640f8322d2d71c14b591a2fcd2854b3aaec0f6654aa9aa413a85b02df2fe119
/**
 * @copyright  (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
 * @license    GNU General Public License version 2 or later; see LICENSE.txt
 */
if (Joomla && Joomla.getOptions('js-extensions-update')) {
  const options = Joomla.getOptions('js-joomla-update');

  const update = (type, text) => {
    const link = document.getElementById('plg_quickicon_joomlaupdate');
    const linkSpans = [].slice.call(link.querySelectorAll('span.j-links-link'));

    if (link) {
      link.classList.add(type);
    }

    if (linkSpans.length) {
      linkSpans.forEach(span => {
        span.innerHTML = Joomla.sanitizeHtml(text);
      });
    }
  };

  fetch(options.ajaxUrl, {
    method: 'GET'
  }).then(response => {
    response.json().then(updateInfoList => {
      if (Array.isArray(updateInfoList)) {
        if (updateInfoList.length === 0) {
          // No updates
          update('success', Joomla.Text._('PLG_QUICKICON_JOOMLAUPDATE_UPTODATE'));
        } else {
          const updateInfo = updateInfoList.shift();

          if (updateInfo.version !== options.version) {
            update('danger', Joomla.Text._('PLG_QUICKICON_JOOMLAUPDATE_UPDATEFOUND').replace('%s', `<span class="badge text-dark bg-light"> \u200E ${updateInfo.version}</span>`));
          } else {
            update('success', Joomla.Text._('PLG_QUICKICON_JOOMLAUPDATE_UPTODATE'));
          }
        }
      } else {
        // An error occurred
        update('danger', Joomla.Text._('PLG_QUICKICON_JOOMLAUPDATE_ERROR'));
      }
    }).catch(() => {
      // An error occurred
      update('danger', Joomla.Text._('PLG_QUICKICON_JOOMLAUPDATE_ERROR'));
    });
  }).catch(() => {
    // An error occurred
    update('danger', Joomla.Text._('PLG_QUICKICON_JOOMLAUPDATE_ERROR'));
  });
}

The same content is in 4 releases, Joomla 4.0.0-rc2 to 4.0.0-rc5. See them all, or every version of this file.