PageSourceSearch

https://www.starwoodhotels.com/themes/custom/starwood/templates/patterns/slideOut/slideout.js?tlrzgr

js starwoodhotels.com collected 2026-09-24 08:29:53 UTC 1,775 bytes, 57 lines download raw bytes

1function trapFocus(element) {
2    var focusableEls = element.querySelectorAll('a[href]:not([disabled]), button:not([disabled]), textarea:not([disabled]), input[type="text"]:not([disabled]), input[type="radio"]:not([disabled]), input[type="checkbox"]:not([disabled]), select:not([disabled])');
3    var firstFocusableEl = focusableEls[0];
4    var lastFocusableEl = focusableEls[focusableEls.length - 1];
5    var KEYCODE_TAB = 9;
6  
7    element.addEventListener('keydown', function(e) {
8      var isTabPressed = (e.key === 'Tab' || e.keyCode === KEYCODE_TAB);
9  
10      if (!isTabPressed) {
11        return;
12      }
13  
14      if ( e.shiftKey ) /* shift + tab */ {
15        if (document.activeElement === firstFocusableEl) {
16          lastFocusableEl.focus();
17            e.preventDefault();
18          }
19        } else /* tab */ {
20        if (document.activeElement === lastFocusableEl) {
21          firstFocusableEl.focus();
22            e.preventDefault();
23          }
24        }
25    });
26  }
27
28(function ( Drupal, once) {
29	Drupal.behaviors.slideOut = {
30		attach: function (context, settings){
31			once('sldieOut', '.slideout', context).forEach(function (element) {
32
33				var buttons = element.querySelectorAll('.slideout__button');
34
35				buttons.forEach( function(button){
36
37					button.addEventListener('click', function() {
38						element.classList.add('slideout--open');
39						button.setAttribute('aria-expanded', true);
40						trapFocus(element.querySelector('.slideout__slide'));
41					});
42
43				});
44
45				element.querySelector('.slideout__close').addEventListener('click', function(){
46
47          		element.classList.remove('slideout--open');
48					buttons.forEach( function(button) {
49						button.setAttribute('aria-expanded', false);
50					});
51				});
52			});
53		},
54
55	}
56 } )
57(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.