CoreFiles by mySites.guru
jupdatecheck.js52 lines, 1,762 bytes, from Joomla_4.0.0-rc1-Release_Candidate-Full_Package.zip
Raw History Compare with 3.10.12-rc1
md5
0d7ef269483766fb2608ea7a5f6e2547
sha1
6dad67669d3d4277f667e774688feb188064561d
sha256
58b12fb72e43d0c8534fdf5a81bd8f618ad44c7be3b3ff2f2e0e1b218653c3b1
/**
 * @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 = 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'));
  });
}

No other release has this exact content. See every version of this file.