1/* global jQuery */ 2/* global Drupal */ 3/* global once */ 4(function($, Drupal, window) { 5 6 Drupal.behaviors.ws_social_share_field__enable_web_share_api = { 7 attach: function(context, settings) { 8 9 // Prise en charge de la Web Share API. 10 const widgetWrappers = once('enable-web-share-api', $('.ws-social-share-field-buttons', context)); 11 widgetWrappers.forEach(function (widgetWrapper) { 12 const $widgetWrapper = $(widgetWrapper); 13 const shareButton = $('.share-button', context); 14 const shareOptions = $('.share-options', context); 15 const params = { 16 title: $widgetWrapper.data('title'), 17 url: $widgetWrapper.data('url'), 18 }; 19 // Si le navigateur est compatible. 20 if (window.navigator.share) { 21 $widgetWrapper.addClass('has-share-button'); 22 shareButton.removeClass('d-none'); 23 shareButton.on('click', () => { 24 window.navigator.share(params) 25 .then(() => {}) 26 .catch((error) => {}); 27 }); 28 } 29 // Fallback : liens de partage. 30 else { 31 shareOptions.removeClass('d-none'); 32 } 33 }); 34 35 } 36 }; 37 38})(jQuery, Drupal, this);
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.