1(function ($, Drupal) { 2 Drupal.behaviors.activitiesTomSelect = { 3 attach: function (context, settings) { 4 5 var selector = '#edit-activitiestype'; 6 var $element = $(selector, context); 7 8 if ($element.length === 0) { 9 //console.warn('no select with ID #edit-activitiestype'); 10 return; 11 } 12 if (!$element.is('select')) { 13 //console.warn('the element is not a select, it is: ', $element.prop('tagName')); 14 return; 15 } 16 if ($element.hasClass('ts-rendered')) { 17 return; 18 } 19 20 if (!$element.hasClass('ts-rendered')) { 21 //var placeholder = $('#edit-activitiestype').attr('data-placeholder') || '...'; 22 23 typeSelect = new TomSelect(selector, { 24 maxItems: 1, 25 searchField: [], 26 controlInput: false, 27 create: false, 28 allowEmptyOption: false, 29 //placeholder: placeholder, 30 }); 31 typeSelect.inputState(); 32 $(selector, context).addClass('ts-rendered'); 33 } 34 } 35 }; 36})(jQuery, Drupal); 37
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.