1(function ($, Drupal, once) { 2 Drupal.behaviors.atix_filelist = { 3 attach: function (context) { 4 once('filelistBehavior', '.filelist-select', context).forEach(function (element) { 5 var selectDest = $(element); 6 var src = selectDest.data('selectChained'); 7 if (src) { 8 //Chain selects 9 selectDest.chained(src); 10 var selectSrc = $(src); 11 12 if (1 === $("option", selectDest).length || selectSrc.val() === "") { 13 selectDest.closest('.js-form-item').hide(); 14 } 15 selectSrc.change(function () { 16 var Opts = $("option", selectDest); 17 if (1 === Opts.length) { 18 selectDest.closest('.js-form-item').hide(); 19 } else { 20 selectDest.closest('.js-form-item').show(); 21 // Prérenseigne la valeur unique 22 if (2 === Opts.length) { 23 selectDest.val(Opts.last().val()).change(); 24 } 25 } 26 }); 27 } 28 selectDest.change(function () { 29 if (1 !== $("option", selectDest).length) { 30 var file = selectDest.find(':selected').data('file'); 31 let fileButton = $(this).closest('.form-atix-filelist').find('.filelist-button'); 32 if (file) { 33 fileButton.attr('data-url', file) 34 fileButton.show(); 35 } else { 36 fileButton.hide(); 37 } 38 } 39 }); 40 selectDest.change(); 41 }); 42 43 $('.filelist-button').click(function () { 44 window.open($(this).attr('data-url')); 45 return false; 46 }); 47 } 48 }; 49})(jQuery, Drupal, once);
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.