X-Git-Url: http://aleph1.co.uk/gitweb/?a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Fsystem%2Fjs%2Fsystem.date.es6.js;h=c011ddd99d68203aaa5df0ab0d476c510fe4e956;hb=5b8bb166bfa98770daef9de5c127fc2e6ef02340;hp=7686d2295752d5258b2abce032882d016bbfb806;hpb=af6d1fb995500ae68849458ee10d66abbdcfb252;p=yaffs-website diff --git a/web/core/modules/system/js/system.date.es6.js b/web/core/modules/system/js/system.date.es6.js index 7686d2295..c011ddd99 100644 --- a/web/core/modules/system/js/system.date.es6.js +++ b/web/core/modules/system/js/system.date.es6.js @@ -3,7 +3,7 @@ * Provides date format preview feature. */ -(function ($, Drupal, drupalSettings) { +(function($, Drupal, drupalSettings) { const dateFormats = drupalSettings.dateFormats; /** @@ -17,8 +17,12 @@ Drupal.behaviors.dateFormat = { attach(context) { const $context = $(context); - const $source = $context.find('[data-drupal-date-formatter="source"]').once('dateFormat'); - const $target = $context.find('[data-drupal-date-formatter="preview"]').once('dateFormat'); + const $source = $context + .find('[data-drupal-date-formatter="source"]') + .once('dateFormat'); + const $target = $context + .find('[data-drupal-date-formatter="preview"]') + .once('dateFormat'); const $preview = $target.find('em'); // All elements have to exist. @@ -34,7 +38,10 @@ */ function dateFormatHandler(e) { const baseValue = $(e.target).val() || ''; - const dateString = baseValue.replace(/\\?(.?)/gi, (key, value) => (dateFormats[key] ? dateFormats[key] : value)); + const dateString = baseValue.replace( + /\\?(.?)/gi, + (key, value) => (dateFormats[key] ? dateFormats[key] : value), + ); $preview.html(dateString); $target.toggleClass('js-hide', !dateString.length); @@ -43,9 +50,13 @@ /** * On given event triggers the date character replacement. */ - $source.on('keyup.dateFormat change.dateFormat input.dateFormat', dateFormatHandler) + $source + .on( + 'keyup.dateFormat change.dateFormat input.dateFormat', + dateFormatHandler, + ) // Initialize preview. .trigger('keyup'); }, }; -}(jQuery, Drupal, drupalSettings)); +})(jQuery, Drupal, drupalSettings);