Update Composer, update everything
This commit is contained in:
parent
ea3e94409f
commit
dda5c284b6
19527 changed files with 1135420 additions and 351004 deletions
|
@ -1,12 +1,17 @@
|
|||
/**
|
||||
* @file
|
||||
* Javascript behaviors for jQuery Word and Counter Counter integration.
|
||||
* JavaScript behaviors for jQuery Text Counter integration.
|
||||
*/
|
||||
|
||||
(function ($, Drupal) {
|
||||
|
||||
'use strict';
|
||||
|
||||
// @see https://github.com/ractoon/jQuery-Text-Counter#options
|
||||
Drupal.webform = Drupal.webform || {};
|
||||
Drupal.webform.counter = Drupal.webform.counter || {};
|
||||
Drupal.webform.counter.options = Drupal.webform.counter.options || {};
|
||||
|
||||
/**
|
||||
* Initialize text field and textarea word and character counter.
|
||||
*
|
||||
|
@ -14,23 +19,39 @@
|
|||
*/
|
||||
Drupal.behaviors.webformCounter = {
|
||||
attach: function (context) {
|
||||
if (!$.fn.textcounter) {
|
||||
return;
|
||||
}
|
||||
|
||||
$(context).find('.js-webform-counter').once('webform-counter').each(function () {
|
||||
var options = {
|
||||
goal: $(this).attr('data-counter-limit'),
|
||||
msg: $(this).attr('data-counter-message')
|
||||
type: $(this).data('counter-type'),
|
||||
max: $(this).data('counter-maximum'),
|
||||
min: $(this).data('counter-minimum') || 0,
|
||||
counterText: $(this).data('counter-minimum-message'),
|
||||
countDownText: $(this).data('counter-maximum-message'),
|
||||
inputErrorClass: 'webform-counter-warning',
|
||||
counterErrorClass: 'webform-counter-warning',
|
||||
countSpaces: true,
|
||||
stopInputAtMaximum: false,
|
||||
// Don't display min/max message since server-side validation will
|
||||
// display these messages.
|
||||
minimumErrorText: '',
|
||||
maximumErrorText: ''
|
||||
};
|
||||
// Only word type can be defined, otherwise the counter defaults to
|
||||
// character counting.
|
||||
if ($(this).attr('data-counter-type') == 'word') {
|
||||
options.type = 'word';
|
||||
|
||||
options.countDown = (options.max) ? true : false;
|
||||
if (!options.counterText) {
|
||||
options.counterText = (options.type === 'word') ? Drupal.t('%d word(s) entered') : Drupal.t('%d characters(s) entered');
|
||||
}
|
||||
if (!options.countDownText) {
|
||||
options.countDownText = (options.type === 'word') ? Drupal.t('%d word(s) remaining') : Drupal.t('%d characters(s) remaining');
|
||||
}
|
||||
|
||||
// Set the target to a div that is appended to end of the input's parent container.
|
||||
options.target = $('<div></div>');
|
||||
$(this).parent().append(options.target);
|
||||
options = $.extend(options, Drupal.webform.counter.options);
|
||||
|
||||
$(this).counter(options);
|
||||
})
|
||||
$(this).textcounter(options);
|
||||
});
|
||||
|
||||
}
|
||||
};
|
||||
|
|
Reference in a new issue