1/** 2 * @file 3 * Facets views Link widgets handling. 4 */ 5 6(function ($, Drupal, once) { 7 'use strict'; 8 9 /** 10 * Handle link widgets. 11 */ 12 Drupal.behaviors.facetsLinkWidget = { 13 attach: function (context) { 14 var $linkFacets = $(once('js-facets-link-on-click', '.js-facets-links', context)); 15 16 // We are using list wrapper element for Facet JS API. 17 if ($linkFacets.length > 0) { 18 $linkFacets 19 .each(function (index, widget) { 20 var $widget = $(widget); 21 var $widgetLinks = $widget.find('.facet-item > a'); 22 23 // Click on link will call Facets JS API on widget element. 24 var clickHandler = function (e) { 25 e.preventDefault(); 26 27 $widget.trigger('facets_filter', [$(this).attr('href')]); 28 }; 29 30 // Add correct CSS selector for the widget. The Facets JS API will 31 // register handlers on that element. 32 $widget.addClass('js-facets-widget'); 33 34 // Add handler for clicks on widget links. 35 $widgetLinks.on('click', clickHandler); 36 37 // We have to trigger attaching of behaviours, so that Facets JS API can 38 // register handlers on link widgets. 39 Drupal.attachBehaviors(this.parentNode, Drupal.settings); 40 }); 41 } 42 } 43 }; 44 45})(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.