![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/old/vendor/magento/module-review/view/adminhtml/web/js/ |
/** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ 'jquery', 'jquery/ui' ], function ($) { 'use strict'; $.widget('marketing.ratingControl', { options: { colorFilled: '#333', colorUnfilled: '#CCCCCC', colorHover: '#f30' }, /** @inheritdoc */ _create: function () { this._labels = this.element.find('label'); this._bind(); }, /** * @private */ _bind: function () { this._labels.on({ click: $.proxy(function (e) { $(e.currentTarget).prev().prop('checked', true); this._updateRating(); }, this), hover: $.proxy(function (e) { this._updateHover($(e.currentTarget), this.options.colorHover); }, this), mouseleave: $.proxy(function (e) { this._updateHover($(e.currentTarget), this.options.colorUnfilled); }, this) }); this._updateRating(); }, /** * @param {jQuery} elem * @param {String} color * @private */ _updateHover: function (elem, color) { elem.nextAll('label').addBack().filter(function () { return !$(this).data('checked'); }).css('color', color); }, /** * @private */ _updateRating: function () { var checkedInputs = this.element.find('input[type="radio"]:checked'); checkedInputs.nextAll('label').addBack().css('color', this.options.colorFilled).data('checked', true); checkedInputs.prevAll('label').css('color', this.options.colorUnfilled).data('checked', false); }, /** * Remove rating when form reset */ removeRating: function () { var checkedInputs = this.element.find('input[type="radio"]'); checkedInputs.nextAll('label').css('color', this.options.colorUnfilled).data('checked', false); } }); });