CoreFiles by mySites.guru
extensionupdatecheck.js67 lines, 2,711 bytes, from Joomla_4.0.0-alpha8-Alpha-Full_Package.zip
Raw History Compare with 4.0.0-alpha7
md5
758e2aac17a86476ea8ab6ef27f87435
sha1
6288196baf79ca59a3599750e17a9b232c134a95
sha256
894e11e5699a74e3fc8f7583ed810ddb6fe3de0712dcd733d6aa52916ea1b87f
/**
* PLEASE DO NOT MODIFY THIS FILE. WORK ON THE ES6 VERSION.
* OTHERWISE YOUR CHANGES WILL BE REPLACED ON THE NEXT BUILD.
**/

/**
 * @copyright  Copyright (C) 2005 - 2019 Open Source Matters, Inc. All rights reserved.
 * @license    GNU General Public License version 2 or later; see LICENSE.txt
 */
// Ajax call to get the update status of the installed extensions
(function () {
  'use strict'; // Add a listener on content loaded to initiate the check

  document.addEventListener('DOMContentLoaded', function () {
    if (Joomla.getOptions('js-extensions-update')) {
      var options = Joomla.getOptions('js-extensions-update');

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

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

        if (linkSpans.length) {
          linkSpans.forEach(function (span) {
            span.innerHTML = text;
          });
        }
      };

      Joomla.request({
        url: options.ajaxUrl,
        method: 'GET',
        data: '',
        perform: true,
        onSuccess: function onSuccess(response) {
          var updateInfoList = JSON.parse(response);

          if (Array.isArray(updateInfoList)) {
            if (updateInfoList.length === 0) {
              // No updates
              update('success', Joomla.Text._('PLG_QUICKICON_EXTENSIONUPDATE_UPTODATE'));
            } else {
              var messages = {
                warning: ["<div class=\"message-alert\">\n  ".concat(Joomla.Text._('PLG_QUICKICON_EXTENSIONUPDATE_UPDATEFOUND_MESSAGE').replace('%s', "<span class=\"badge badge-pill badge-danger\">".concat(updateInfoList.length, "</span>")), "\n  <button type=\"button\" class=\"btn btn-sm btn-primary\" onclick=\"document.location='").concat(options.url, "'\">\n    ").concat(Joomla.Text._('PLG_QUICKICON_EXTENSIONUPDATE_UPDATEFOUND_BUTTON'), "\n  </button>\n</div>")]
              }; // Render the message

              Joomla.renderMessages(messages); // Scroll to page top

              window.scrollTo(0, 0);
              update('warning', Joomla.Text._('PLG_QUICKICON_EXTENSIONUPDATE_UPDATEFOUND').replace('%s', "<span class=\"badge badge-light\">".concat(updateInfoList.length, "</span>")));
            }
          } else {
            // An error occurred
            update('danger', Joomla.Text._('PLG_QUICKICON_EXTENSIONUPDATE_ERROR'));
          }
        },
        onError: function onError() {
          // An error occurred
          update('danger', Joomla.Text._('PLG_QUICKICON_EXTENSIONUPDATE_ERROR'));
        }
      });
    }
  });
})();

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