1(function ($, Drupal, drupalSettings) { 2 'use strict'; 3 4 Drupal.behaviors.clear_field_custom = { 5 attach: function (context, settings) { 6 var form_text_class = drupalSettings.clear_field_custom.form_text_class; 7 var span_class = '.' + drupalSettings.clear_field_custom.span_class; 8 var classes = ''; 9 10 $.map(form_text_class, function (value, index) { 11 if (form_text_class.length && (form_text_class.length - 1) === index) { 12 classes = classes + 'input.' + value; 13 } 14 if (form_text_class.length && (form_text_class.length - 1) !== index) { 15 classes = classes + 'input.' + value + ', '; 16 } 17 }); 18 19 /*$(classes, context).each(function () { 20 if ($(this).val()) { 21 var parent = $(this).parent().once(); 22 parent.append(drupalSettings.clear_field_custom.close_button); 23 } 24 });*/ 25 26 $("input[name^='field_daterange1'][name$='[end_value][time]']").each(function( index ) { 27 var parent = $(this).parent().once(); 28 if (parent.find('input').val()!="" || parent.parent().find('input').val()!="" || parent.parent().parent().find('input').val()!="" || parent.parent().parent().parent().find('input').val()!="") { 29 parent.append(drupalSettings.clear_field_custom.close_button); // si un seul des champs du date range est rempli on affiche le bouton 30 } 31 }); 32 33 $(document).on('click', span_class, function (e) { 34 e.preventDefault(); 35 $(this).parent().find('input').val(''); // heure de fin 36 $(this).parent().parent().find('input').val(''); // date de fin 37 $(this).parent().parent().parent().find('input').val(''); //heure de debut 38 $(this).parent().parent().parent().parent().find('input').val(''); // date de debut 39 $(this).remove(); 40 }); 41 42 $(classes, context).change(function () { 43 var parent = $(this).parent(); 44 if ($(this).val() && !$(this).parent().find('.clear-field').length) { 45 parent.append(drupalSettings.clear_field_custom.close_button); 46 } 47 else { 48 if (!$(this).val()) { 49 parent.find('.clear-field').remove(); 50 } 51 } 52 }); 53 } 54 }; 55 56})(jQuery, Drupal, drupalSettings);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.