1/** 2 * Behaviors for collapsible menu. 3 */ 4(function($) { 5 6 /** 7 * Adds toggle link. 8 * Toggles menu on small resolutions. 9 * Restores menu on window width increasing. 10 */ 11 Drupal.behaviors.responsiveBartikCollapsibleMenu = { 12 attach: function (context, settings) { 13 14 // We can keep menu collapsed up to width maxWidth. 15 var maxWidth = 445; 16 17 // Do nothing if menu is empty. 18 if ($('#main-menu-links a').length == 0) { 19 return; 20 } 21 22 // Append toggle link to the main menu if not already exists. 23 if ($('a#menu-toggle').length == 0) { 24 $('nav#main-menu').append('<a href="#" id="menu-toggle">' + Drupal.t('Menu') + '</a>'); 25 } 26 else { 27 return; 28 } 29 30 // Collapse/expand menu by click on link. 31 $('a#menu-toggle').click(function() { 32 $('#main-menu-links').slideToggle('fast'); 33 return false; 34 }); 35 36 // Restore visibility settings of menu on increasing of windows width over 445px. 37 // Media query works with width up to 460px. But I guess we should take into account some padding. 38 $(window).resize(function(){ 39 var w = $(window).width(); 40 // Remove all styles if window size more than maxWidth and menu is hidden. 41 if(w > maxWidth && $('#main-menu-links').is(':hidden')) { 42 $('#main-menu-links').removeAttr('style'); 43 } 44 }); 45 } 46 } 47})(jQuery); 48;/*})'"*/;/*})'"*/ 49/** 50 * Workaround for .position() behaviour which was changed in jQuery 3.3 51 * @see https://github.com/jquery/api.jquery.com/issues/1081 52 */ 53var Drupal = Drupal || {}; 54 55(function ($, Drupal) { 56 // Overload Drupal.jsAC.prototype.populatePopup 57 if (Drupal.jsAC !== undefined && Drupal.jsAC.prototype.populatePopup !== undefined) { 58 Drupal.jsAC.prototype.populatePopup = function () { 59 var $input = $(this.input); 60 var offset = $input.offset(); 61 var offsetParent = $input.offsetParent().offset(); 62 // Show popup. 63 if (this.popup) { 64 $(this.popup).remove(); 65 } 66 this.selected = false; 67 this.popup = $('<div id="autocomplete"></div>')[0]; 68 this.popup.owner = this; 69 $(this.popup).css({ 70 top: parseInt(offset.top - offsetParent.top + this.input.offsetHeight, 10) + 'px', 71 left: parseInt(offset.left - offsetParent.left, 10) + 'px', 72 width: $input.innerWidth() + 'px', 73 display: 'none' 74 }); 75 $input.before(this.popup); 76 77 // Do search. 78 this.db.owner = this; 79 this.db.search(this.input.value); 80 }; 81 } 82})(jQuery, Drupal); 83;/*})'"*/;/*})'"*/
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.