CoreFiles by mySites.guru
color-field-adv-init.js43 lines, 1,395 bytes, from Joomla_6.2.1-Stable-Full_Package.zip
Raw History Compare with 6.2.0
md5
cbd1c4d4f5c11d3e0ba052bd06438b69
sha1
fa7c84b6b253add5a0ef121110a60ebdb49e1292
sha256
fe17b7df7f984bc436cdf1ad0112f349329380303ece3ee577736ef9a1bc6496
/**
 * @copyright   (C) 2016 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

!(function(document, $) {
  "use strict";

  function initMinicolorsField (event) {
    $(event.target).find('.minicolors').each(function () {
      const position = $(this).attr('data-position') || 'default';
      const isRtl = document.documentElement.dir === 'rtl';

      $(this).minicolors({
        control: $(this).attr('data-control') || 'hue',
        format: $(this).attr('data-validate') === 'color'
          ? 'hex'
          : ($(this).attr('data-format') === 'rgba'
            ? 'rgb'
            : $(this).attr('data-format'))
          || 'hex',
        keywords: $(this).attr('data-keywords') || '',
        opacity: $(this).attr('data-format') === 'rgba',
        position: isRtl
          ? (position === 'left' ? 'right' : position === 'right' ? 'left' : position)
          : position,
        swatches: $(this).attr('data-colors') ? $(this).attr('data-colors').split(',') : [],
        theme: 'bootstrap'
      });
    });
  }

  /**
   * Initialize at an initial page load
   */
  document.addEventListener("DOMContentLoaded", initMinicolorsField);

  /**
   * Initialize when a part of the page was updated
   */
  document.addEventListener("joomla:updated", initMinicolorsField);

})(document, jQuery);

The same content is in 3 releases, Joomla 6.2.1-rc1 to 6.3.0-alpha1. See them all, or every version of this file.