PageSourceSearch

https://specmachinery.com.ua/plugins/system/t4/themes/base/vendors/js-offcanvas/_js/js-offcanvas.pkgd.js

js specmachinery.com.ua collected 2026-10-03 18:01:19 UTC 24,407 bytes, 895 lines download raw bytes

1;(function( window ){
2	"use strict";
3
4	var utils = window.utils || {};
5
6	utils.classes = {
7		hiddenVisually: "u-hidden-visually",
8		modifier: "--",
9		isActive: "is-active",
10		isClosed: "is-closed",
11		isOpen: "is-open",
12		isClicked: "is-clicked",
13		isAnimating: "is-animating",
14		isVisible: "is-visible",
15		hidden: "u-hidden"
16	};
17
18	utils.keyCodes = {
19		BACKSPACE: 8,
20		COMMA: 188,
21		DELETE: 46,
22		DOWN: 40,
23		END: 35,
24		ENTER: 13,
25		ESCAPE: 27,
26		HOME: 36,
27		LEFT: 37,
28		PAGE_DOWN: 34,
29		PAGE_UP: 33,
30		PERIOD: 190,
31		RIGHT: 39,
32		SPACE: 32,
33		TAB: 9,
34		UP: 38
35	};
36
37	utils.a11yclick = function(event) {
38		var code = event.charCode || event.keyCode,
39			type = event.type;
40
41		if (type === 'click') {
42			return true;
43		} else if (type === 'keydown') {
44			if (code === utils.keyCodes.SPACE || code === utils.keyCodes.ENTER) {
45				return true;
46			}
47		} else {
48			return false;
49		}
50	};
51
52	utils.a11yclickBind = function(el, callback, name) {
53		el.on("click." + name + " keydown." + name,function(event){
54			if ( utils.a11yclick(event)) {
55				event.preventDefault(event);
56				if( callback && typeof callback === 'function' ) { callback.call(); }
57				el.trigger('clicked.'+name);
58			}
59		});
60	};
61
62	utils.supportTransition = ('transition' in document.documentElement.style) || ('WebkitTransition' in document.documentElement.style);
63
64	utils.whichTransitionEvent = function () {
65		var el = document.createElement('fakeelement'),
66			transitions = {
67				'transition': 'transitionend',
68				'WebkitTransition': 'webkitTransitionEnd'
69			};
70
71		for (var t in transitions) {
72			if (el.style[t] !== undefined) {
73				return transitions[t];
74			}
75		}
76	};
77
78	utils.transEndEventName = utils.whichTransitionEvent();
79
80	utils.onEndTransition = function( el, callback ) {
81		var onEndCallbackFn = function( ev ) {
82			if( utils.supportTransition ) {
83				if( ev.target != this ) return;
84				this.removeEventListener( utils.transEndEventName, onEndCallbackFn );
85			}
86			if( callback && typeof callback === 'function' ) { callback.call(); }
87		};
88		if( utils.supportTransition ) {
89			el.addEventListener( utils.transEndEventName, onEndCallbackFn );
90		}
91		else {
92			onEndCallbackFn();
93		}
94	};
95
96	utils.createModifierClass = function( cl, modifier ){
97		return cl + utils.classes.modifier + modifier
98	};
99
100	utils.cssModifiers = function( modifiers, cssClasses, baseClass ){
101		var arr = modifiers.split(",");
102		for(var i=0, l = arr.length; i < l; i++){
103			cssClasses.push( utils.createModifierClass(baseClass,arr[i].trim()) );
104		}
105	};
106
107	utils.getMetaOptions = function( el, name, metadata ){
108		var dataAttr = 'data-' + name,
109			dataOptionsAttr = dataAttr + '-options',
110			attr = el.getAttribute( dataAttr ) || el.getAttribute( dataOptionsAttr );
111		try {
112			return attr && JSON.parse( attr ) || {};
113		} catch ( error ) {
114			// log error, do not initialize
115			if ( console ) {
116				console.error( 'Error parsing ' + dataAttr + ' on ' + el.className + ': ' + error );
117			}
118			return;
119		}
120	};
121
122	window.utils = utils;
123
124})(this);
125
126
127/*
128 * TrapTabKey
129 * Based on https://github.com/gdkraus/accessible-modal-dialog/blob/master/modal-window.js
130 * Copyright (c) 2016 Vasileios Mitsaras.
131 * Licensed under MIT
132 */
133
134(function( w, $ ){
135	"use strict";
136
137	var name = "trab-tab",
138		componentName = name + "-component";
139
140	w.componentNamespace = w.componentNamespace || {};
141
142	var TrapTabKey = w.componentNamespace.TrapTabKey = function( element,options ){
143		if( !element ){
144			throw new Error( "Element required to initialize object" );
145		}
146		// assign element for method events
147		this.element = element;
148		this.$element = $( element );
149		// Options
150		options = options || {};
151		this.options = $.extend( {}, this.defaults, options );
152	};
153
154
155	TrapTabKey.prototype.init = function(){
156
157		if ( this.$element.data( componentName ) ) {
158			return;
159		}
160
161		this.$element.data( componentName, this );
162	};
163
164	TrapTabKey.prototype.bindTrap = function(){
165		var self = this;
166
167		this.$element
168			.on( 'keydown.' + name, function( e ){
169				self._trapTabKey(self.$element, e );
170			} );
171	};
172
173	TrapTabKey.prototype.unbindTrap = function(){
174		this.$element
175			.off( 'keydown.' + name);
176	};
177
178	TrapTabKey.prototype.giveFocus = function(){
179		var self = this,
180			opts = self.options;
181
182		// get list of all children elements in given object
183		var o = self.$element.find('*'),
184			focusEl = self.$element.find('[data-focus]');
185
186		// set the focus to the first keyboard focusable item
187		focusEl.length ? focusEl.first().focus() : o.filter(opts.focusableElementsString).filter(':visible').first().focus();
188
189	};
190
191
192	TrapTabKey.prototype._trapTabKey = function(obj, evt){
193		var self = this,
194			opts = self.options;
195
196		// if tab or shift-tab pressed
197		if (evt.which == 9) {
198
199			// get list of all children elements in given object
200			var o = obj.find('*');
201
202			// get list of focusable items
203			var focusableItems;
204			focusableItems = o.filter(opts.focusableElementsString).filter(':visible');
205
206			// get currently focused item
207			var focusedItem;
208			focusedItem = jQuery(':focus');
209
210			// get the number of focusable items
211			var numberOfFocusableItems;
212			numberOfFocusableItems = focusableItems.length;
213
214			// get the index of the currently focused item
215			var focusedItemIndex;
216			focusedItemIndex = focusableItems.index(focusedItem);
217
218			if (evt.shiftKey) {
219				//back tab
220				// if focused on first item and user preses back-tab, go to the last focusable item
221				if (focusedItemIndex == 0) {
222					focusableItems.get(numberOfFocusableItems - 1).focus();
223					evt.preventDefault();
224				}
225
226			} else {
227				//forward tab
228				// if focused on the last item and user preses tab, go to the first focusable item
229				if (focusedItemIndex == numberOfFocusableItems - 1) {
230					focusableItems.get(0).focus();
231					evt.preventDefault();
232				}
233			}
234		}
235
236	};
237
238	TrapTabKey.prototype.defaults = {
239		focusableElementsString : "a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), iframe, object, embed, *[tabindex], *[contenteditable]"
240	};
241
242	TrapTabKey.defaults = TrapTabKey.prototype.defaults;
243
244})(this, jQuery);
245
246(function( window, $ ){
247	"use strict";
248	var name = "button",
249		componentName = name + "-component",
250		utils = window.utils,
251		cl = {
252			iconOnly: "icon-only",
253			withIcon: "icon",
254			toggleState: "toggle-state",
255			showHide: "visible-on-active"
256		};
257
258	window.componentNamespace = window.componentNamespace || {};
259
260	var Button = window.componentNamespace.Button = function( element, options ){
261		if( !element ){
262			throw new Error( "Element required to initialize object" );
263		}
264		// assign element for method events
265		this.element = element;
266		this.$element = $( element );
267		// Options
268		this.options = options = options || {};
269		this.metadata = utils.getMetaOptions( this.element, name );
270		this.options = $.extend( {}, this.defaults, this.metadata, options );
271	};
272
273	Button.prototype.init = function(){
274
275		if ( this.$element.data( componentName ) ) {
276			return;
277		}
278
279		this.$element.data( componentName, this );
280		this.hasTitle = !!this.$element.attr( "title" );
281		this.$element.trigger( "beforecreate." + name );
282		this.isPressed = false;
283		this.isExpanded = false;
284		this._create();
285
286	};
287
288	Button.prototype._create = function(){
289		var options = this.options,
290			buttonTextClasses = [options.baseClass + '__text'];
291
292		this._buttonClasses = [options.baseClass];
293		if ( options.label === null ) {
294			options.label = this.$element.html();
295		}
296
297		if ( options.wrapText ) {
298			this.$buttonText = $( '<span></span>' ).html( options.label ).appendTo(this.$element.empty());
299		}
300
301		if ( options.icon ) {
302
303			this.$buttonIcon = $( "<span class='"+ options.iconFamily +' ' + utils.createModifierClass(options.iconFamily, options.icon)+"'></span>" ).prependTo(this.$element);
304			this._buttonClasses.push( utils.createModifierClass(options.baseClass,cl.withIcon) );
305
306			if ( options.iconActive ) {
307				options.toggle = true;
308				this.$buttonIconActive = $( "<span class='"+ options.iconFamily  + ' ' + utils.createModifierClass(options.iconFamily, options.iconActive)+ ' ' +utils.createModifierClass(options.iconFamily, cl.showHide)+ "'></span>" ).insertAfter(this.$buttonIcon);
309				this._buttonClasses.push( utils.createModifierClass(options.baseClass,cl.toggleState) );
310			}
311			if ( options.hideText ) {
312				buttonTextClasses.push(utils.classes.hiddenVisually );
313				this._buttonClasses.push( utils.createModifierClass(options.baseClass,cl.iconOnly) );
314			}
315		}
316
317		if ( options.modifiers ) {
318			utils.cssModifiers(options.modifiers,this._buttonClasses,options.baseClass);
319		}
320		if ( options.wrapText ) {
321			this.$buttonText.addClass( buttonTextClasses.join( " " ) );
322		}
323
324		if ( options.textActive && options.wrapText ) {
325			options.toggle = true;
326			buttonTextClasses.push( utils.createModifierClass(options.baseClass+'__text',cl.showHide) );
327			this._buttonClasses.push( utils.createModifierClass(options.baseClass,cl.toggleState) );
328
329			this.$buttonTextActive = $( '<span></span>' )
330				.addClass( buttonTextClasses.join( " " ) )
331				.html( options.textActive )
332				.insertAfter(this.$buttonText);
333			this.$element.attr('aria-live','polite');
334		}
335
336		this.$element.addClass( this._buttonClasses.join( " " ) );
337
338		if ( options.role) {
339			this.$element.attr( "role", options.role );
340		}
341		if ( options.controls ) {
342			this.controls(options.controls);
343		}
344		if ( options.pressed ) {
345			this._isPressed(options.pressed);
346		}
347		if ( options.expanded ) {
348			this.isPressed = true;
349			this._isExpanded(options.expanded);
350		}
351		if ( !this.hasTitle && options.hideText && !options.hideTitle ) {
352			this.$element.attr('title',this.$element.text());
353		}
354		this.$element.trigger( "create." + name );
355	};
356
357	Button.prototype._isPressed = function(state){
358		this.isPressed = state;
359		this.$element.attr( "aria-pressed", state )[ state ? "addClass" : "removeClass" ](utils.classes.isActive);
360	};
361
362	Button.prototype._isExpanded = function(state){
363		this.isExpanded = state;
364		this.$element.attr( "aria-expanded", state )[ state ? "addClass" : "removeClass" ](utils.classes.isActive);
365	};
366
367	Button.prototype.controls = function(el){
368		this.$element.attr( "aria-controls", el );
369	};
370
371	Button.prototype.destroy = function(){
372		var options = this.options;
373
374		this.$element
375			.removeData(componentName)
376			.removeAttr('role')
377			.removeAttr('aria-pressed')
378			.removeAttr('aria-expanded')
379			.removeAttr('aria-controls')
380			.removeClass( this._buttonClasses.join( " " ) )
381			.removeClass( utils.classes.isActive)
382			.off("."+name);
383		if ( this.options.icon ) {
384			this.$element.find('[class^="'+this.options.iconFamily+'"]').remove();
385		}
386
387		if ( options.wrapText ) {
388			var btnHtml = this.$buttonText.html();
389			this.$element.empty().html(btnHtml);
390		}
391
392		this.element = null;
393		this.$element = null;
394	};
395
396	Button.prototype.defaults = {
397		baseClass:"c-button",
398		role: "button",
399		label: null,
400		modifiers: null,
401		controls: null,
402		textActive: null,
403		wrapText: true,
404		hideText: false,
405		hideTitle: false,
406		icon: null,
407		iconActive: null,
408		iconFamily: "o-icon",
409		iconPosition: null,
410		pressed: false,
411		expanded: false
412	};
413
414	Button.defaults = Button.prototype.defaults;
415
416})(this, jQuery);
417
418(function( w, $ ){
419	"use strict";
420
421	var pluginName = "jsButton",
422		initSelector = ".js-button";
423
424	$.fn[ pluginName ] = function(){
425		return this.each( function(){
426			new window.componentNamespace.Button( this ).init();
427		});
428	};
429
430	// auto-init on enhance (which is called on domready)
431	$( document ).bind( "enhance", function( e ){
432		$( $( e.target ).is( initSelector ) && e.target ).add( initSelector, e.target ).filter( initSelector )[ pluginName ]();
433	});
434})(this, jQuery);
435
436;(function( window, $ ){
437	"use strict";
438
439	var name = "offcanvas",
440		componentName = name + "-component",
441		utils = window.utils,
442		doc = document;
443
444	window.componentNamespace = window.componentNamespace || {};
445
446	var Offcanvas = window.componentNamespace.Offcanvas = function( element,options ){
447		if( !element ){
448			throw new Error( "Element required to initialize object" );
449		}
450		// assign element for method events
451		this.element = element;
452		this.$element = $( element );
453		// Options
454		this.options = options = options || {};
455		this.metadata = utils.getMetaOptions( this.element, name );
456		this.options = $.extend( {}, this.defaults, this.metadata, options );
457		this.isOpen = false;
458		this.onOpen = this.options.onOpen;
459		this.onClose = this.options.onClose;
460		this.onInit = this.options.onInit;
461	};
462
463	Offcanvas.prototype.init = function(){
464		if ( this.$element.data( componentName ) ) {
465			return;
466		}
467		this.$element.data( componentName, this );
468		this.$element.trigger( "beforecreate." + name );
469		this._addAttributes();
470		this._initTrigger();
471		this._createModal();
472		this._trapTabKey();
473		this._closeButton();
474		if( this.onInit && typeof this.onInit === 'function' ) {
475			this.onInit.call(this.element);
476		}
477		this.$element.trigger( "create." + name );
478	};
479
480	Offcanvas.prototype._addAttributes = function(){
481		var options = this.options,
482			panelAttr = {
483				tabindex: "-1",
484				"aria-hidden": !this.isOpen
485			};
486
487		if ( options.role) {
488			panelAttr.role = options.role;
489		}
490		this._panelClasses = [options.baseClass,utils.classes.isClosed];
491
492		if(!window.utils.supportTransition){
493			this._panelClasses.push( utils.createModifierClass(options.baseClass, options.supportNoTransitionsClass));
494		}
495		utils.cssModifiers(options.modifiers,this._panelClasses,options.baseClass );
496		this.$element.attr(panelAttr).addClass( this._panelClasses.join( " " ) );
497
498		// Content-wrap
499		this.$content = $('.' + options.contentClass);
500		this._contentOpenClasses = [];
501		utils.cssModifiers(options.modifiers,this._contentOpenClasses,options.contentClass );
502
503		// Modal
504		this._modalOpenClasses = [options.modalClass,utils.classes.isClosed ];
505		utils.cssModifiers(options.modifiers,this._modalOpenClasses,options.modalClass );
506
507		// body
508		this._bodyOpenClasses = [options.bodyModifierClass+"--visible"];
509		utils.cssModifiers(options.modifiers,this._bodyOpenClasses,options.bodyModifierClass);
510
511		if (options.modifiers.toLowerCase().indexOf("reveal") >= 0) {
512			this.transitionElement =  this.$content[0];
513		} else {
514			this.transitionElement = this.element ;
515		}
516	};
517
518	Offcanvas.prototype._createModal= function() {
519		var self = this,
520			target = self.$element.parent();
521		if (this.options.modal) {
522			this.$modal = $( "<div></div>" )
523				.on( "mousedown."+name, function() {
524					self.close();
525				})
526				.appendTo( target );
527			this.$modal.addClass( this._modalOpenClasses.join( " " ) );
528		}
529	};
530
531	Offcanvas.prototype._trapTabKey = function() {
532		this.trapTabKey = new window.componentNamespace.TrapTabKey(this.element);
533		this.trapTabKey.init();
534	};
535
536	Offcanvas.prototype._trapTabEscKey = function() {
537		var self = this;
538		// close on ESC
539		$( doc ).on( "keyup." + name, function(ev){
540			var keyCode = ev.keyCode || ev.which;
541			if( keyCode === utils.keyCodes.ESCAPE && self.isOpen ) {
542				if ($("input").is(":focus")) {
543					return;
544				}
545				self.close();
546			}
547		} );
548	};
549
550	Offcanvas.prototype._closeButton = function() {
551		var self = this,
552			options = self.options;
553		function closeOffcanvas(){
554			self.close();
555		}
556		this.$closeBtn = this.$element.find('.'+options.closeButtonClass);
557		if( this.$closeBtn.length ){
558			this.closeBtn = new window.componentNamespace.Button(this.$closeBtn[0]);
559			this.closeBtn.init();
560			this.closeBtn.controls(this.$element.attr('id'));
561			utils.a11yclickBind(this.$closeBtn,closeOffcanvas,name);
562		}
563	};
564
565	Offcanvas.prototype.open = function(){
566		var self = this,
567			options = self.options;
568		if (!this.isOpen) {
569			if (options.resize) {
570				this.resize();
571			}
572			if( doc.activeElement ){
573				this.lastFocus = doc.activeElement;
574				this.lastFocusTrigger = $(this.lastFocus).data( "button-component");
575			}
576			this.isOpen = true;
577			$('html, body').addClass(this._bodyOpenClasses.join(" "));
578
579			this._addClasses(this.$element,this.isOpen,true);
580			this._addClasses(this.$content,this.isOpen,true);
581			if (options.modal) {
582				this._addClasses(this.$modal,this.isOpen,true);
583				this.$modal.addClass(utils.createModifierClass(options.modalClass,'opening'));
584			}
585
586			this.$element.attr( "aria-hidden", "false" )
587				.addClass(utils.createModifierClass(options.baseClass,'opening'))
588				.trigger( "opening." + name );
589			this.$content.addClass( this._contentOpenClasses.join( " " ));
590
591			// Transition End Callback
592			utils.onEndTransition ( this.transitionElement, function() {
593				self.trapTabKey.giveFocus();
594				self.trapTabKey.bindTrap();
595				self._addClasses(self.$element,self.isOpen,false);
596				self._addClasses(self.$content,self.isOpen,false);
597				if (options.modal) {
598					self._addClasses(self.$modal,self.isOpen,false);
599					self.$modal.removeClass(utils.createModifierClass(options.modalClass,'opening'));
600				}
601				self.$element.removeClass(utils.createModifierClass(options.baseClass,'opening'));
602			} );
603			if( this.$trigger ){
604				this.$trigger.button._isExpanded(true);
605			}
606			if(this.lastFocusTrigger) {
607				this.lastFocusTrigger._isExpanded(true);
608			}
609			// callback on open
610			if( this.onOpen && typeof this.onOpen === 'function' ) {
611				this.onOpen.call(this.$element);
612			}
613			// close on ESC
614			this._trapTabEscKey();
615			this.$element.trigger( "open." + name );
616		}
617	};
618
619	Offcanvas.prototype.close = function(){
620		var self = this,
621			options = self.options;
622		if( !this.isOpen ){
623			return;
624		}
625		this.isOpen = false;
626
627		this._addClasses(this.$element,this.isOpen,true);
628		this._addClasses(this.$content,this.isOpen,true);
629
630		if (this.options.modal) {
631			this._addClasses(this.$modal,this.isOpen,true);
632			this.$modal.addClass(utils.createModifierClass(options.modalClass,'closing'));
633		}
634
635		this.$element.attr( "aria-hidden", "true" )
636			.addClass(utils.createModifierClass(options.baseClass,'closing'))
637			.trigger( "closing." + name );
638
639		this.trapTabKey.unbindTrap();
640
641		if( self.$trigger ){
642			self.$trigger.button._isExpanded(false);
643		}
644
645		if(this.lastFocusTrigger) {
646			this.lastFocusTrigger._isExpanded(false);
647			this.lastFocusTrigger = null;
648		}
649
650		utils.onEndTransition ( this.transitionElement, function() {
651
652			self._addClasses(self.$element,self.isOpen,false);
653			self._addClasses(self.$content,self.isOpen,false);
654
655			if (self.options.modal) {
656				self._addClasses(self.$modal,self.isOpen,false);
657				self.$modal.removeClass(utils.createModifierClass(options.modalClass,'closing'));
658			}
659
660			self.$content.removeClass( self._contentOpenClasses.join( " " ) );
661			self.$element.removeClass(utils.createModifierClass(options.baseClass,'closing'));
662
663			$('html, body').removeClass(self._bodyOpenClasses.join(" "));
664
665			if( self.lastFocus ){
666				self.lastFocus.focus();
667			}
668		} );
669		// callback onClose
670		if( this.onClose && typeof this.onClose === 'function' ) {
671			this.onClose.call(this.element);
672		}
673		this.$element.trigger( "close." + name );
674		$( doc ).off( "keyup." + name);
675		$(window).off('.'+name);
676	};
677
678	Offcanvas.prototype._addClasses = function(el,isOpen,beforeTransition){
679		if (isOpen) {
680			if (beforeTransition) {
681				el
682					.removeClass(utils.classes.isClosed)
683					.addClass(utils.classes.isAnimating)
684					.addClass(utils.classes.isOpen);
685			} else {
686				el.removeClass(utils.classes.isAnimating);
687			}
688		} else {
689			if (beforeTransition) {
690				el
691					.removeClass( utils.classes.isOpen  )
692					.addClass( utils.classes.isAnimating );
693			} else {
694				el
695					.addClass( utils.classes.isClosed )
696					.removeClass( utils.classes.isAnimating );
697			}
698		}
699	};
700
701	Offcanvas.prototype.toggle = function(){
702		this[ this.isOpen ? "close" : "open" ]();
703	};
704
705	Offcanvas.prototype.resize = function(){
706		var self = this,ticking;
707
708		var raf = (function(){
709			return  window.requestAnimationFrame   ||
710				window.webkitRequestAnimationFrame ||
711				window.mozRequestAnimationFrame    ||
712				function( callback ){
713					window.setTimeout(callback, 1000 / 60);
714				};
715		})();
716
717		function update() {
718			ticking = false;
719		}
720		function requestTick() {
721			if(!ticking) {
722				raf(update);
723			}
724			ticking = true;
725		}
726		function onResize() {
727			requestTick();
728			self.$element.trigger( "resizing." + name );
729			if (self.options.resize) {
730				self.close();
731			}
732		}
733		$(window).on('resize.' + name + ' orientationchange.' + name, onResize);
734	};
735
736	Offcanvas.prototype._initTrigger = function() {
737		var self = this,
738			options = self.options,
739			offcanvasID = this.$element.attr('id');
740
741		if (options.triggerButton ) {
742			this.$triggerBtn = $(options.triggerButton);
743			new window.componentNamespace.OffcanvasTrigger(this.$triggerBtn[0], {"offcanvas": offcanvasID}).init();
744		}
745	};
746
747	Offcanvas.prototype.setButton = function(trigger){
748		this.$element.data( componentName + "-trigger", trigger );
749	};
750
751	Offcanvas.prototype.destroy = function(){
752
753		this.$element.trigger( "destroy." + name );
754
755		if( this.isOpen ){
756			this.close();
757		}
758
759			this.$element
760			.removeData()
761			.removeClass( this._panelClasses.join( " " ) )
762			.removeAttr('tabindex')
763			.removeAttr('aria-hidden');
764
765		if( this.$triggerBtn ){
766			this.$triggerBtn
767				.removeData('offcanvas-trigger-component')
768				.off(".offcanvas")
769				.off(".offcanvas-trigger")
770				.data('button-component').destroy();
771		}
772
773		this.$element.off( "." + name );
774		$( doc ).off( "." + name);
775		$(window).off('.'+name);
776
777	};
778
779	Offcanvas.prototype.defaults = {
780		role: "dialog",
781		modifiers: "left,overlay",
782		baseClass: "c-offcanvas",
783		modalClass: "c-offcanvas-bg",
784		contentClass: "c-offcanvas-content-wrap",
785		closeButtonClass: "js-offcanvas-close",
786		bodyModifierClass: "has-offcanvas",
787		supportNoTransitionsClass: "support-no-transitions",
788		resize: false,
789		triggerButton: null,
790		modal: true,
791		onOpen: null,
792		onClose: null,
793		onInit: null
794	};
795
796	Offcanvas.defaults = Offcanvas.prototype.defaults;
797
798})(this, jQuery);
799
800(function( w, $ ){
801	"use strict";
802
803	var pluginName = "offcanvas",
804		initSelector = ".js-" + pluginName;
805
806	$.fn[ pluginName ] = function(options){
807		return this.each( function(){
808			new w.componentNamespace.Offcanvas( this, options ).init();
809		});
810	};
811
812	// auto-init on enhance (which is called on domready)
813	$( w.document ).on( "enhance", function(e){
814		$( $( e.target ).is( initSelector ) && e.target ).add( initSelector, e.target ).filter( initSelector )[ pluginName ]();
815	});
816
817})(this, jQuery);
818
819(function( w, $ ){
820	"use strict";
821
822	var name = "offcanvas-trigger",
823		componentName = name + "-component",
824		utils = w.utils;
825
826	w.componentNamespace = w.componentNamespace || {};
827
828	var OffcanvasTrigger = w.componentNamespace.OffcanvasTrigger = function( element,options ){
829		if( !element ){
830			throw new Error( "Element required to initialize object" );
831		}
832		// assign element for method events
833		this.element = element;
834		this.$element = $( element );
835		// Options
836		this.options = options = options || {};
837		this.options = $.extend( {}, this.defaults, options );
838	};
839
840	OffcanvasTrigger.prototype.init = function(){
841
842		if ( this.$element.data( componentName ) ) {
843			return;
844		}
845		this.$element.data( componentName, this );
846		this._create();
847	};
848
849	OffcanvasTrigger.prototype._create = function(){
850		this.options.offcanvas = this.options.offcanvas || this.$element.attr( "data-offcanvas-trigger" );
851		this.$offcanvas = $( "#" + this.options.offcanvas );
852		this.offcanvas = this.$offcanvas.data( "offcanvas-component" );
853		if (!this.offcanvas) {
854			throw new Error( "Offcanvas Element not found" );
855		}
856		this.button = new w.componentNamespace.Button(this.element);
857		this.button.init();
858		this.button.controls(this.options.offcanvas);
859		this.button._isExpanded(false);
860		this._bindbehavior();
861	};
862
863	OffcanvasTrigger.prototype._bindbehavior = function(){
864		var self = this;
865		this.offcanvas.setButton(self);
866		function toggleOffcanvas(){
867			self.offcanvas.toggle();
868		}
869		utils.a11yclickBind(this.$element,toggleOffcanvas,name);
870	};
871
872	OffcanvasTrigger.prototype.defaults = {
873		offcanvas: null
874	};
875
876})(this, jQuery);
877
878(function( w, $ ){
879	"use strict";
880
881	var pluginName = "offcanvasTrigger",
882		initSelector = "[data-offcanvas-trigger],.js-" + pluginName;
883
884	$.fn[ pluginName ] = function(options){
885		return this.each( function(){
886			new w.componentNamespace.OffcanvasTrigger( this,options ).init();
887		});
888	};
889
890	// auto-init on enhance (which is called on domready)
891	$( w.document ).on( "enhance", function(e){
892		$( $( e.target ).is( initSelector ) && e.target ).add( initSelector, e.target ).filter( initSelector )[ pluginName ]();
893	});
894
895})(this, jQuery);

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.