Move all files to 2017/
This commit is contained in:
parent
ac7370f67f
commit
2875863330
15717 changed files with 0 additions and 0 deletions
|
|
@ -0,0 +1,51 @@
|
|||
/**
|
||||
* @file
|
||||
* JavaScript behaviors for RateIt integration.
|
||||
*/
|
||||
|
||||
(function ($, Drupal) {
|
||||
|
||||
'use strict';
|
||||
|
||||
// All options can be override using custom data-* attributes.
|
||||
// @see https://github.com/gjunge/rateit.js/wiki#options.
|
||||
|
||||
/**
|
||||
* Initialize rating element using RateIt.
|
||||
*
|
||||
* @type {Drupal~behavior}
|
||||
*/
|
||||
Drupal.behaviors.webformRating = {
|
||||
attach: function (context) {
|
||||
if (!$.fn.rateit) {
|
||||
return;
|
||||
}
|
||||
|
||||
$(context)
|
||||
.find('[data-rateit-backingfld]')
|
||||
.once('webform-rating')
|
||||
.each(function () {
|
||||
var $rateit = $(this);
|
||||
var $input = $($rateit.attr('data-rateit-backingfld'));
|
||||
|
||||
// Rateit only initialize inputs on load.
|
||||
if (document.readyState === 'complete') {
|
||||
$rateit.rateit();
|
||||
}
|
||||
|
||||
// Update the RateIt widget when the input's value has changed.
|
||||
// @see webform.states.js
|
||||
$input.on('change', function () {
|
||||
$rateit.rateit('value', $input.val());
|
||||
});
|
||||
|
||||
// Set RateIt widget to be readonly when the input is disabled.
|
||||
// @see webform.states.js
|
||||
$input.on('webform:disabled', function () {
|
||||
$rateit.rateit('readonly', $input.is(':disabled'));
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
})(jQuery, Drupal);
|
||||
Reference in a new issue