1/** 2* DO NOT EDIT THIS FILE. 3* See the following change record for more information, 4* https://www.drupal.org/node/2815083 5* @preserve 6**/ 7(function ($, Drupal) { 8 function DropButton(dropbutton, settings) { 9 var options = $.extend({ 10 title: Drupal.t('List additional actions') 11 }, settings); 12 var $dropbutton = $(dropbutton); 13 this.$dropbutton = $dropbutton; 14 this.$list = $dropbutton.find('.dropbutton'); 15 this.$actions = this.$list.find('li').addClass('dropbutton-action'); 16 if (this.$actions.length > 1) { 17 var $primary = this.$actions.slice(0, 1); 18 var $secondary = this.$actions.slice(1); 19 $secondary.addClass('secondary-action'); 20 $primary.after(Drupal.theme('dropbuttonToggle', options)); 21 this.$dropbutton.addClass('dropbutton-multiple').on({ 22 'mouseleave.dropbutton': $.proxy(this.hoverOut, this), 23 'mouseenter.dropbutton': $.proxy(this.hoverIn, this), 24 'focusout.dropbutton': $.proxy(this.focusOut, this), 25 'focusin.dropbutton': $.proxy(this.focusIn, this) 26 }); 27 } else { 28 this.$dropbutton.addClass('dropbutton-single'); 29 } 30 } 31 function dropbuttonClickHandler(e) { 32 e.preventDefault(); 33 $(e.target).closest('.dropbutton-wrapper').toggleClass('open'); 34 } 35 Drupal.behaviors.dropButton = { 36 attach: function attach(context, settings) { 37 var dropbuttons = once('dropbutton', '.dropbutton-wrapper', context); 38 if (dropbuttons.length) { 39 var body = once('dropbutton-click', 'body'); 40 if (body.length) { 41 $(body).on('click', '.dropbutton-toggle', dropbuttonClickHandler); 42 } 43 dropbuttons.forEach(function (dropbutton) { 44 DropButton.dropbuttons.push(new DropButton(dropbutton, settings.dropbutton)); 45 }); 46 } 47 } 48 }; 49 $.extend(DropButton, { 50 dropbuttons: [] 51 }); 52 $.extend(DropButton.prototype, { 53 toggle: function toggle(show) { 54 var isBool = typeof show === 'boolean'; 55 show = isBool ? show : !this.$dropbutton.hasClass('open'); 56 this.$dropbutton.toggleClass('open', show); 57 }, 58 hoverIn: function hoverIn() { 59 if (this.timerID) { 60 window.clearTimeout(this.timerID); 61 } 62 }, 63 hoverOut: function hoverOut() { 64 this.timerID = window.setTimeout($.proxy(this, 'close'), 500); 65 }, 66 open: function open() { 67 this.toggle(true); 68 }, 69 close: function close() { 70 this.toggle(false); 71 }, 72 focusOut: function focusOut(e) { 73 this.hoverOut.call(this, e); 74 }, 75 focusIn: function focusIn(e) { 76 this.hoverIn.call(this, e); 77 } 78 }); 79 $.extend(Drupal.theme, { 80 dropbuttonToggle: function dropbuttonToggle(options) { 81 return "<li class=\"dropbutton-toggle\"><button type=\"button\"><span class=\"dropbutton-arrow\"><span class=\"visually-hidden\">".concat(options.title, "</span></span></button></li>"); 82 } 83 }); 84 Drupal.DropButton = DropButton; 85})(jQuery, Drupal);
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.