diff --git a/.editorconfig b/.editorconfig
index 9b73521..6e87a00 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -4,7 +4,7 @@ root = true
[*]
charset = utf-8
indent_style = space
-indent_size = 4
+indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true
diff --git a/.eslintrc b/.eslintrc
index 8e16686..ba9c48e 100644
--- a/.eslintrc
+++ b/.eslintrc
@@ -14,7 +14,7 @@
"block-spacing": ["error"],
"comma-dangle": ["error", "never"],
"comma-spacing": ["error", { "before": false, "after": true }],
- "indent": ["error", 4], // modify this depending on the project
+ "indent": ["error", 2], // modify this depending on the project
"key-spacing": ["error", { "beforeColon": false }],
"keyword-spacing": ["error", { "before": true, "after": true }],
"linebreak-style": ["error", "unix"],
diff --git a/brochure/js/launchy.js b/brochure/js/launchy.js
index 2ba489e..4f63c61 100644
--- a/brochure/js/launchy.js
+++ b/brochure/js/launchy.js
@@ -16,4 +16,4 @@ var Launchy=function(t){function e(o){if(n[o])return n[o].exports;var i=n[o]={i:
* @version 0.8.1
* @license MIT
*/
-n(1);var a={modalLaunchLink:"launchy__launch-link",modalCloseLink:"launchy__close-link",modalWindow:"launchy__window",modalContent:"launchy__content",modalOverlay:"launchy__overlay",modalTitle:"launchy__title",modalWindowIsVisible:"launchy__window--is-visible",modalOverlayIsVisible:"launchy__overlay--is-visible"},r={launchyText:"data-launchy-text",launchyTitle:"data-launchy-title",launchyButton:"data-launchy-button",launchyCustom:{close:"data-launchy-close",refocus:"data-launchy-refocus"}},s={Escape:27},l={launchyElements:"[data-launchy]",launchyControl:"launchy-control-",launchyDialog:"launchy-dialog-",launchyCloseControl:"launchy-close-control-",modalOverlay:"modal-overlay-",modalBumper:"modal-bumper-",modalTitle:"modal-title-"},d={modalClose:"Close modal window!",modalCloseHTML:'×',modalError:"Launchy container must have a `data-launchy-text` attribute!",modalErrorEmpty:"Launchy container `data-launchy-text` attribute cannot be empty!",modalWarning:"Launchy container should have a `data-launchy-title` attribute, or be sure to supply your own heading! (Prefereably an `
`.)",refocusElemNotFound:"Refocus element not found!"},u=0,h=function(){function t(e){o(this,t),this.focusable=n(2),this.launchyId=u,this.hasTitle=!!e.title,this.useButton=!!e.button,this.modalIsVisible=!1,this.activeElement=null,this.shiftKeyIsPressed=!1,this.allFocusable=null,this.firstFocusable=null,this.lastFocusable=null,this.domFocusable=null,this.createElements(e),this.insertElements(e),this.setupEventListeners(),u++}return i(t,[{key:"createElements",value:function(t){console.log(this.useButton),this.launchControl=document.createElement(this.useButton?"button":"a"),this.launchControl.id=""+l.launchyControl+this.launchyId,this.useButton?this.launchControl.type="button":this.launchControl.href="#"+l.launchyDialog+this.launchyId,this.launchControl.classList.add(a.modalLaunchLink),this.launchControl.setAttribute("aria-haspopup","dialog"),this.launchControl.textContent=t.text,this.closeControl=document.createElement(this.useButton?"button":"a"),this.closeControl.id=""+l.launchyCloseControl+this.launchyId,this.useButton?this.closeControl.type="button":this.closeControl.href="#"+l.launchyControl+this.launchyId,this.closeControl.classList.add(a.modalCloseLink),this.closeControl.setAttribute("aria-label",d.modalClose),this.closeControl.innerHTML=d.modalCloseHTML,this.modalWindow=document.createElement("div"),this.modalWindow.id=""+l.launchyDialog+this.launchyId,this.modalWindow.classList.add(a.modalWindow),this.modalWindow.setAttribute("tabindex",-1),this.modalWindow.setAttribute("role","dialog"),this.modalWindow.setAttribute("aria-modal",!0),this.hasTitle&&this.modalWindow.setAttribute("aria-labelledby",""+l.modalTitle+this.launchyId),this.modalOverlay=document.createElement("div"),this.modalOverlay.id=""+l.modalOverlay+this.launchyId,this.modalOverlay.classList.add(a.modalOverlay),this.modalOverlay.setAttribute("tabindex",0),this.modalBumper=document.createElement("div"),this.modalBumper.id=""+l.modalBumper+this.launchyId,this.modalBumper.setAttribute("tabindex",0),this.modalContent=document.createElement("div"),this.modalContent.classList.add(a.modalContent),this.hasTitle&&(this.modalTitle=document.createElement("h2"),this.modalTitle.id=""+l.modalTitle+this.launchyId,this.modalTitle.classList.add(a.modalTitle),this.modalTitle.textContent=t.title)}},{key:"insertElements",value:function(t){t.target.parentNode.insertBefore(this.launchControl,t.target),t.target.parentNode.insertBefore(this.modalWindow,t.target),this.modalWindow.appendChild(this.modalContent),this.modalContent.appendChild(this.closeControl),this.hasTitle&&this.modalContent.appendChild(this.modalTitle),this.modalContent.appendChild(t.target),document.body.appendChild(this.modalOverlay),document.body.insertBefore(this.modalBumper,document.body.firstChild)}},{key:"setupEventListeners",value:function(){var t=this.modalContent.querySelectorAll("["+r.launchyCustom.close+"]"),e=this.modalContent.querySelectorAll("["+r.launchyCustom.refocus+"]");this.launchControl.addEventListener("click",this.showModal.bind(this),!1),this.closeControl.addEventListener("click",this.hideModal.bind(this),!1),this.modalOverlay.addEventListener("click",this.hideModal.bind(this),!1),document.addEventListener("focus",this.trapFocus.bind(this),!0),document.addEventListener("keydown",this.checkEsc.bind(this),!1),document.addEventListener("keydown",this.checkShift.bind(this),!1);var n=!0,o=!1,i=void 0;try{for(var a,s=Array.from(t)[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){a.value.addEventListener("click",this.hideModal.bind(this),!1)}}catch(t){o=!0,i=t}finally{try{!n&&s.return&&s.return()}finally{if(o)throw i}}var l=!0,d=!1,u=void 0;try{for(var h,c=Array.from(e)[Symbol.iterator]();!(l=(h=c.next()).done);l=!0){h.value.addEventListener("click",this.hideModalRefocus.bind(this),!1)}}catch(t){d=!0,u=t}finally{try{!l&&c.return&&c.return()}finally{if(d)throw u}}}},{key:"showModal",value:function(t){t.preventDefault(),this.activeElement=document.activeElement,this.modalIsVisible=!0,this.allFocusable=this.modalWindow.querySelectorAll(this.focusable),this.firstFocusable=this.allFocusable[0],this.lastFocusable=this.allFocusable[this.allFocusable.length-1],this.modalWindow.classList.add(a.modalWindowIsVisible),this.modalOverlay.classList.add(a.modalOverlayIsVisible),this.inertElements(!0),this.modalWindow.focus()}},{key:"hideModal",value:function(t){t.preventDefault(),this.modalIsVisible=!1,this.allFocusable=null,this.firstFocusable=null,this.lastFocusable=null,this.modalWindow.classList.remove(a.modalWindowIsVisible),this.modalOverlay.classList.remove(a.modalOverlayIsVisible),this.inertElements(!1),this.activeElement.focus()}},{key:"trapFocus",value:function(t){this.modalIsVisible&&!this.modalWindow.contains(t.target)&&(t.stopPropagation(),this.shiftKeyIsPressed?this.lastFocusable.focus():this.firstFocusable.focus())}},{key:"checkEsc",value:function(t){this.modalIsVisible&&t.keyCode===s.Escape&&this.hideModal(t)}},{key:"checkShift",value:function(t){this.modalIsVisible&&(this.shiftKeyIsPressed=t.shiftKey)}},{key:"hideModalRefocus",value:function(t){var e=t.target.getAttribute(r.launchyCustom.refocus),n=document.querySelector("#"+e);if(null==n)throw Error(d.refocusElemNotFound+": #"+e);this.hideModal(t),n.focus()}},{key:"inertElements",value:function(t){var e=document.querySelectorAll(this.focusable),n=!0,o=!1,i=void 0;try{for(var a,r=Array.from(e)[Symbol.iterator]();!(n=(a=r.next()).done);n=!0){var s=a.value;this.modalOverlay===s||this.modalBumper===s||this.modalWindow.contains(s)||(s.inert=t)}}catch(t){o=!0,i=t}finally{try{!n&&r.return&&r.return()}finally{if(o)throw i}}}}]),t}(),c=function(){var t=document.querySelectorAll(l.launchyElements),e=null,n=null,o=null,i=!0,a=!1,s=void 0;try{for(var u,c=Array.from(t)[Symbol.iterator]();!(i=(u=c.next()).done);i=!0){var y=u.value;if(e=y.getAttribute(r.launchyText),n=y.getAttribute(r.launchyTitle),o=y.hasAttribute(r.launchyButton),!e)throw Error(d.modalError);if(""===e.trim())throw Error(d.modalErrorEmpty);n||console.warn(d.modalWarning);new h({target:y,text:e,title:n,button:o})}}catch(t){a=!0,s=t}finally{try{!i&&c.return&&c.return()}finally{if(a)throw s}}};document.addEventListener("DOMContentLoaded",c,!1),e.Launchy=h},function(t,e,n){!function(t,e){e()}(0,function(){"use strict";function t(t,e){var n=window.Element.prototype,o=n.matches||n.mozMatchesSelector||n.msMatchesSelector||n.oMatchesSelector||n.webkitMatchesSelector;if(!t||1!==t.nodeType)return!1;var i=t.parentNode;if(o)return o.call(t,e);for(var a=i.querySelectorAll(e),r=a.length,s=0;s×',modalError:"Launchy container must have a `data-launchy-text` attribute!",modalErrorEmpty:"Launchy container `data-launchy-text` attribute cannot be empty!",modalWarning:"Launchy container should have a `data-launchy-title` attribute, or be sure to supply your own heading! (Prefereably an ``.)",refocusElemNotFound:"Refocus element not found!"},u=0,h=function(){function t(e){o(this,t),this.focusable=n(2),this.launchyId=u,this.hasTitle=!!e.title,this.useButton=!!e.button,this.modalIsVisible=!1,this.activeElement=null,this.shiftKeyIsPressed=!1,this.allFocusable=null,this.firstFocusable=null,this.lastFocusable=null,this.domFocusable=null,this.createElements(e),this.insertElements(e),this.setupEventListeners(),u++}return i(t,[{key:"createElements",value:function(t){this.launchControl=document.createElement(this.useButton?"button":"a"),this.launchControl.id=""+l.launchyControl+this.launchyId,this.useButton?this.launchControl.type="button":this.launchControl.href="#"+l.launchyDialog+this.launchyId,this.launchControl.classList.add(a.modalLaunchLink),this.launchControl.setAttribute("aria-haspopup","dialog"),this.launchControl.textContent=t.text,this.closeControl=document.createElement(this.useButton?"button":"a"),this.closeControl.id=""+l.launchyCloseControl+this.launchyId,this.useButton?this.closeControl.type="button":this.closeControl.href="#"+l.launchyControl+this.launchyId,this.closeControl.classList.add(a.modalCloseLink),this.closeControl.setAttribute("aria-label",d.modalClose),this.closeControl.innerHTML=d.modalCloseHTML,this.modalWindow=document.createElement("div"),this.modalWindow.id=""+l.launchyDialog+this.launchyId,this.modalWindow.classList.add(a.modalWindow),this.modalWindow.setAttribute("tabindex",-1),this.modalWindow.setAttribute("role","dialog"),this.modalWindow.setAttribute("aria-modal",!0),this.hasTitle&&this.modalWindow.setAttribute("aria-labelledby",""+l.modalTitle+this.launchyId),this.modalOverlay=document.createElement("div"),this.modalOverlay.id=""+l.modalOverlay+this.launchyId,this.modalOverlay.classList.add(a.modalOverlay),this.modalOverlay.setAttribute("tabindex",-1),this.modalBumper=document.createElement("div"),this.modalBumper.id=""+l.modalBumper+this.launchyId,this.modalBumper.setAttribute("tabindex",-1),this.modalContent=document.createElement("div"),this.modalContent.classList.add(a.modalContent),this.hasTitle&&(this.modalTitle=document.createElement("h2"),this.modalTitle.id=""+l.modalTitle+this.launchyId,this.modalTitle.classList.add(a.modalTitle),this.modalTitle.textContent=t.title)}},{key:"insertElements",value:function(t){t.target.parentNode.insertBefore(this.launchControl,t.target),t.target.parentNode.insertBefore(this.modalWindow,t.target),this.modalWindow.appendChild(this.modalContent),this.modalContent.appendChild(this.closeControl),this.hasTitle&&this.modalContent.appendChild(this.modalTitle),this.modalContent.appendChild(t.target),document.body.appendChild(this.modalOverlay),document.body.insertBefore(this.modalBumper,document.body.firstChild)}},{key:"setupEventListeners",value:function(){var t=this.modalContent.querySelectorAll("["+r.launchyCustom.close+"]"),e=this.modalContent.querySelectorAll("["+r.launchyCustom.refocus+"]");this.launchControl.addEventListener("click",this.showModal.bind(this),!1),this.closeControl.addEventListener("click",this.hideModal.bind(this),!1),this.modalOverlay.addEventListener("click",this.hideModal.bind(this),!1),document.addEventListener("focus",this.trapFocus.bind(this),!0),document.addEventListener("keydown",this.checkEsc.bind(this),!1),document.addEventListener("keydown",this.checkShift.bind(this),!1);var n=!0,o=!1,i=void 0;try{for(var a,s=Array.from(t)[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){a.value.addEventListener("click",this.hideModal.bind(this),!1)}}catch(t){o=!0,i=t}finally{try{!n&&s.return&&s.return()}finally{if(o)throw i}}var l=!0,d=!1,u=void 0;try{for(var h,c=Array.from(e)[Symbol.iterator]();!(l=(h=c.next()).done);l=!0){h.value.addEventListener("click",this.hideModalRefocus.bind(this),!1)}}catch(t){d=!0,u=t}finally{try{!l&&c.return&&c.return()}finally{if(d)throw u}}}},{key:"showModal",value:function(t){t.preventDefault(),this.activeElement=document.activeElement,this.modalIsVisible=!0,this.allFocusable=this.modalWindow.querySelectorAll(this.focusable),this.firstFocusable=this.allFocusable[0],this.lastFocusable=this.allFocusable[this.allFocusable.length-1],this.modalWindow.classList.add(a.modalWindowIsVisible),this.modalOverlay.classList.add(a.modalOverlayIsVisible),this.inertElements(!0),this.modalOverlay.setAttribute("tabindex",0),this.modalBumper.setAttribute("tabindex",0),this.modalWindow.focus()}},{key:"hideModal",value:function(t){t.preventDefault(),this.modalIsVisible=!1,this.allFocusable=null,this.firstFocusable=null,this.lastFocusable=null,this.modalWindow.classList.remove(a.modalWindowIsVisible),this.modalOverlay.classList.remove(a.modalOverlayIsVisible),this.inertElements(!1),this.modalOverlay.setAttribute("tabindex",-1),this.modalBumper.setAttribute("tabindex",-1),this.activeElement.focus()}},{key:"trapFocus",value:function(t){this.modalIsVisible&&!this.modalWindow.contains(t.target)&&(t.stopPropagation(),this.shiftKeyIsPressed?this.lastFocusable.focus():this.firstFocusable.focus())}},{key:"checkEsc",value:function(t){this.modalIsVisible&&t.keyCode===s.Escape&&this.hideModal(t)}},{key:"checkShift",value:function(t){this.modalIsVisible&&(this.shiftKeyIsPressed=t.shiftKey)}},{key:"hideModalRefocus",value:function(t){var e=t.target.getAttribute(r.launchyCustom.refocus),n=document.querySelector("#"+e);if(null==n)throw Error(d.refocusElemNotFound+": #"+e);this.hideModal(t),n.focus()}},{key:"inertElements",value:function(t){var e=document.querySelectorAll(this.focusable),n=!0,o=!1,i=void 0;try{for(var a,r=Array.from(e)[Symbol.iterator]();!(n=(a=r.next()).done);n=!0){var s=a.value;this.modalOverlay===s||this.modalBumper===s||this.modalWindow.contains(s)||(s.inert=t)}}catch(t){o=!0,i=t}finally{try{!n&&r.return&&r.return()}finally{if(o)throw i}}}}]),t}(),c=function(){var t=document.querySelectorAll(l.launchyElements),e=null,n=null,o=null,i=!0,a=!1,s=void 0;try{for(var u,c=Array.from(t)[Symbol.iterator]();!(i=(u=c.next()).done);i=!0){var y=u.value;if(e=y.getAttribute(r.launchyText),n=y.getAttribute(r.launchyTitle),o=y.hasAttribute(r.launchyButton),!e)throw Error(d.modalError);if(""===e.trim())throw Error(d.modalErrorEmpty);n||console.warn(d.modalWarning);new h({target:y,text:e,title:n,button:o})}}catch(t){a=!0,s=t}finally{try{!i&&c.return&&c.return()}finally{if(a)throw s}}};document.addEventListener("DOMContentLoaded",c,!1),e.Launchy=h},function(t,e,n){!function(t,e){e()}(0,function(){"use strict";function t(t,e){var n=window.Element.prototype,o=n.matches||n.mozMatchesSelector||n.msMatchesSelector||n.oMatchesSelector||n.webkitMatchesSelector;if(!t||1!==t.nodeType)return!1;var i=t.parentNode;if(o)return o.call(t,e);for(var a=i.querySelectorAll(e),r=a.length,s=0;s×',modalError:"Launchy container must have a `data-launchy-text` attribute!",modalErrorEmpty:"Launchy container `data-launchy-text` attribute cannot be empty!",modalWarning:"Launchy container should have a `data-launchy-title` attribute, or be sure to supply your own heading! (Prefereably an ``.)",refocusElemNotFound:"Refocus element not found!"},u=0,h=function(){function t(e){o(this,t),this.focusable=n(2),this.launchyId=u,this.hasTitle=!!e.title,this.useButton=!!e.button,this.modalIsVisible=!1,this.activeElement=null,this.shiftKeyIsPressed=!1,this.allFocusable=null,this.firstFocusable=null,this.lastFocusable=null,this.domFocusable=null,this.createElements(e),this.insertElements(e),this.setupEventListeners(),u++}return i(t,[{key:"createElements",value:function(t){console.log(this.useButton),this.launchControl=document.createElement(this.useButton?"button":"a"),this.launchControl.id=""+l.launchyControl+this.launchyId,this.useButton?this.launchControl.type="button":this.launchControl.href="#"+l.launchyDialog+this.launchyId,this.launchControl.classList.add(a.modalLaunchLink),this.launchControl.setAttribute("aria-haspopup","dialog"),this.launchControl.textContent=t.text,this.closeControl=document.createElement(this.useButton?"button":"a"),this.closeControl.id=""+l.launchyCloseControl+this.launchyId,this.useButton?this.closeControl.type="button":this.closeControl.href="#"+l.launchyControl+this.launchyId,this.closeControl.classList.add(a.modalCloseLink),this.closeControl.setAttribute("aria-label",d.modalClose),this.closeControl.innerHTML=d.modalCloseHTML,this.modalWindow=document.createElement("div"),this.modalWindow.id=""+l.launchyDialog+this.launchyId,this.modalWindow.classList.add(a.modalWindow),this.modalWindow.setAttribute("tabindex",-1),this.modalWindow.setAttribute("role","dialog"),this.modalWindow.setAttribute("aria-modal",!0),this.hasTitle&&this.modalWindow.setAttribute("aria-labelledby",""+l.modalTitle+this.launchyId),this.modalOverlay=document.createElement("div"),this.modalOverlay.id=""+l.modalOverlay+this.launchyId,this.modalOverlay.classList.add(a.modalOverlay),this.modalOverlay.setAttribute("tabindex",0),this.modalBumper=document.createElement("div"),this.modalBumper.id=""+l.modalBumper+this.launchyId,this.modalBumper.setAttribute("tabindex",0),this.modalContent=document.createElement("div"),this.modalContent.classList.add(a.modalContent),this.hasTitle&&(this.modalTitle=document.createElement("h2"),this.modalTitle.id=""+l.modalTitle+this.launchyId,this.modalTitle.classList.add(a.modalTitle),this.modalTitle.textContent=t.title)}},{key:"insertElements",value:function(t){t.target.parentNode.insertBefore(this.launchControl,t.target),t.target.parentNode.insertBefore(this.modalWindow,t.target),this.modalWindow.appendChild(this.modalContent),this.modalContent.appendChild(this.closeControl),this.hasTitle&&this.modalContent.appendChild(this.modalTitle),this.modalContent.appendChild(t.target),document.body.appendChild(this.modalOverlay),document.body.insertBefore(this.modalBumper,document.body.firstChild)}},{key:"setupEventListeners",value:function(){var t=this.modalContent.querySelectorAll("["+r.launchyCustom.close+"]"),e=this.modalContent.querySelectorAll("["+r.launchyCustom.refocus+"]");this.launchControl.addEventListener("click",this.showModal.bind(this),!1),this.closeControl.addEventListener("click",this.hideModal.bind(this),!1),this.modalOverlay.addEventListener("click",this.hideModal.bind(this),!1),document.addEventListener("focus",this.trapFocus.bind(this),!0),document.addEventListener("keydown",this.checkEsc.bind(this),!1),document.addEventListener("keydown",this.checkShift.bind(this),!1);var n=!0,o=!1,i=void 0;try{for(var a,s=Array.from(t)[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){a.value.addEventListener("click",this.hideModal.bind(this),!1)}}catch(t){o=!0,i=t}finally{try{!n&&s.return&&s.return()}finally{if(o)throw i}}var l=!0,d=!1,u=void 0;try{for(var h,c=Array.from(e)[Symbol.iterator]();!(l=(h=c.next()).done);l=!0){h.value.addEventListener("click",this.hideModalRefocus.bind(this),!1)}}catch(t){d=!0,u=t}finally{try{!l&&c.return&&c.return()}finally{if(d)throw u}}}},{key:"showModal",value:function(t){t.preventDefault(),this.activeElement=document.activeElement,this.modalIsVisible=!0,this.allFocusable=this.modalWindow.querySelectorAll(this.focusable),this.firstFocusable=this.allFocusable[0],this.lastFocusable=this.allFocusable[this.allFocusable.length-1],this.modalWindow.classList.add(a.modalWindowIsVisible),this.modalOverlay.classList.add(a.modalOverlayIsVisible),this.inertElements(!0),this.modalWindow.focus()}},{key:"hideModal",value:function(t){t.preventDefault(),this.modalIsVisible=!1,this.allFocusable=null,this.firstFocusable=null,this.lastFocusable=null,this.modalWindow.classList.remove(a.modalWindowIsVisible),this.modalOverlay.classList.remove(a.modalOverlayIsVisible),this.inertElements(!1),this.activeElement.focus()}},{key:"trapFocus",value:function(t){this.modalIsVisible&&!this.modalWindow.contains(t.target)&&(t.stopPropagation(),this.shiftKeyIsPressed?this.lastFocusable.focus():this.firstFocusable.focus())}},{key:"checkEsc",value:function(t){this.modalIsVisible&&t.keyCode===s.Escape&&this.hideModal(t)}},{key:"checkShift",value:function(t){this.modalIsVisible&&(this.shiftKeyIsPressed=t.shiftKey)}},{key:"hideModalRefocus",value:function(t){var e=t.target.getAttribute(r.launchyCustom.refocus),n=document.querySelector("#"+e);if(null==n)throw Error(d.refocusElemNotFound+": #"+e);this.hideModal(t),n.focus()}},{key:"inertElements",value:function(t){var e=document.querySelectorAll(this.focusable),n=!0,o=!1,i=void 0;try{for(var a,r=Array.from(e)[Symbol.iterator]();!(n=(a=r.next()).done);n=!0){var s=a.value;this.modalOverlay===s||this.modalBumper===s||this.modalWindow.contains(s)||(s.inert=t)}}catch(t){o=!0,i=t}finally{try{!n&&r.return&&r.return()}finally{if(o)throw i}}}}]),t}(),c=function(){var t=document.querySelectorAll(l.launchyElements),e=null,n=null,o=null,i=!0,a=!1,s=void 0;try{for(var u,c=Array.from(t)[Symbol.iterator]();!(i=(u=c.next()).done);i=!0){var y=u.value;if(e=y.getAttribute(r.launchyText),n=y.getAttribute(r.launchyTitle),o=y.hasAttribute(r.launchyButton),!e)throw Error(d.modalError);if(""===e.trim())throw Error(d.modalErrorEmpty);n||console.warn(d.modalWarning);new h({target:y,text:e,title:n,button:o})}}catch(t){a=!0,s=t}finally{try{!i&&c.return&&c.return()}finally{if(a)throw s}}};document.addEventListener("DOMContentLoaded",c,!1),e.Launchy=h},function(t,e,n){!function(t,e){e()}(0,function(){"use strict";function t(t,e){var n=window.Element.prototype,o=n.matches||n.mozMatchesSelector||n.msMatchesSelector||n.oMatchesSelector||n.webkitMatchesSelector;if(!t||1!==t.nodeType)return!1;var i=t.parentNode;if(o)return o.call(t,e);for(var a=i.querySelectorAll(e),r=a.length,s=0;s×',modalError:"Launchy container must have a `data-launchy-text` attribute!",modalErrorEmpty:"Launchy container `data-launchy-text` attribute cannot be empty!",modalWarning:"Launchy container should have a `data-launchy-title` attribute, or be sure to supply your own heading! (Prefereably an ``.)",refocusElemNotFound:"Refocus element not found!"},u=0,h=function(){function t(e){o(this,t),this.focusable=n(2),this.launchyId=u,this.hasTitle=!!e.title,this.useButton=!!e.button,this.modalIsVisible=!1,this.activeElement=null,this.shiftKeyIsPressed=!1,this.allFocusable=null,this.firstFocusable=null,this.lastFocusable=null,this.domFocusable=null,this.createElements(e),this.insertElements(e),this.setupEventListeners(),u++}return i(t,[{key:"createElements",value:function(t){this.launchControl=document.createElement(this.useButton?"button":"a"),this.launchControl.id=""+l.launchyControl+this.launchyId,this.useButton?this.launchControl.type="button":this.launchControl.href="#"+l.launchyDialog+this.launchyId,this.launchControl.classList.add(a.modalLaunchLink),this.launchControl.setAttribute("aria-haspopup","dialog"),this.launchControl.textContent=t.text,this.closeControl=document.createElement(this.useButton?"button":"a"),this.closeControl.id=""+l.launchyCloseControl+this.launchyId,this.useButton?this.closeControl.type="button":this.closeControl.href="#"+l.launchyControl+this.launchyId,this.closeControl.classList.add(a.modalCloseLink),this.closeControl.setAttribute("aria-label",d.modalClose),this.closeControl.innerHTML=d.modalCloseHTML,this.modalWindow=document.createElement("div"),this.modalWindow.id=""+l.launchyDialog+this.launchyId,this.modalWindow.classList.add(a.modalWindow),this.modalWindow.setAttribute("tabindex",-1),this.modalWindow.setAttribute("role","dialog"),this.modalWindow.setAttribute("aria-modal",!0),this.hasTitle&&this.modalWindow.setAttribute("aria-labelledby",""+l.modalTitle+this.launchyId),this.modalOverlay=document.createElement("div"),this.modalOverlay.id=""+l.modalOverlay+this.launchyId,this.modalOverlay.classList.add(a.modalOverlay),this.modalOverlay.setAttribute("tabindex",-1),this.modalBumper=document.createElement("div"),this.modalBumper.id=""+l.modalBumper+this.launchyId,this.modalBumper.setAttribute("tabindex",-1),this.modalContent=document.createElement("div"),this.modalContent.classList.add(a.modalContent),this.hasTitle&&(this.modalTitle=document.createElement("h2"),this.modalTitle.id=""+l.modalTitle+this.launchyId,this.modalTitle.classList.add(a.modalTitle),this.modalTitle.textContent=t.title)}},{key:"insertElements",value:function(t){t.target.parentNode.insertBefore(this.launchControl,t.target),t.target.parentNode.insertBefore(this.modalWindow,t.target),this.modalWindow.appendChild(this.modalContent),this.modalContent.appendChild(this.closeControl),this.hasTitle&&this.modalContent.appendChild(this.modalTitle),this.modalContent.appendChild(t.target),document.body.appendChild(this.modalOverlay),document.body.insertBefore(this.modalBumper,document.body.firstChild)}},{key:"setupEventListeners",value:function(){var t=this.modalContent.querySelectorAll("["+r.launchyCustom.close+"]"),e=this.modalContent.querySelectorAll("["+r.launchyCustom.refocus+"]");this.launchControl.addEventListener("click",this.showModal.bind(this),!1),this.closeControl.addEventListener("click",this.hideModal.bind(this),!1),this.modalOverlay.addEventListener("click",this.hideModal.bind(this),!1),document.addEventListener("focus",this.trapFocus.bind(this),!0),document.addEventListener("keydown",this.checkEsc.bind(this),!1),document.addEventListener("keydown",this.checkShift.bind(this),!1);var n=!0,o=!1,i=void 0;try{for(var a,s=Array.from(t)[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){a.value.addEventListener("click",this.hideModal.bind(this),!1)}}catch(t){o=!0,i=t}finally{try{!n&&s.return&&s.return()}finally{if(o)throw i}}var l=!0,d=!1,u=void 0;try{for(var h,c=Array.from(e)[Symbol.iterator]();!(l=(h=c.next()).done);l=!0){h.value.addEventListener("click",this.hideModalRefocus.bind(this),!1)}}catch(t){d=!0,u=t}finally{try{!l&&c.return&&c.return()}finally{if(d)throw u}}}},{key:"showModal",value:function(t){t.preventDefault(),this.activeElement=document.activeElement,this.modalIsVisible=!0,this.allFocusable=this.modalWindow.querySelectorAll(this.focusable),this.firstFocusable=this.allFocusable[0],this.lastFocusable=this.allFocusable[this.allFocusable.length-1],this.modalWindow.classList.add(a.modalWindowIsVisible),this.modalOverlay.classList.add(a.modalOverlayIsVisible),this.inertElements(!0),this.modalOverlay.setAttribute("tabindex",0),this.modalBumper.setAttribute("tabindex",0),this.modalWindow.focus()}},{key:"hideModal",value:function(t){t.preventDefault(),this.modalIsVisible=!1,this.allFocusable=null,this.firstFocusable=null,this.lastFocusable=null,this.modalWindow.classList.remove(a.modalWindowIsVisible),this.modalOverlay.classList.remove(a.modalOverlayIsVisible),this.inertElements(!1),this.modalOverlay.setAttribute("tabindex",-1),this.modalBumper.setAttribute("tabindex",-1),this.activeElement.focus()}},{key:"trapFocus",value:function(t){this.modalIsVisible&&!this.modalWindow.contains(t.target)&&(t.stopPropagation(),this.shiftKeyIsPressed?this.lastFocusable.focus():this.firstFocusable.focus())}},{key:"checkEsc",value:function(t){this.modalIsVisible&&t.keyCode===s.Escape&&this.hideModal(t)}},{key:"checkShift",value:function(t){this.modalIsVisible&&(this.shiftKeyIsPressed=t.shiftKey)}},{key:"hideModalRefocus",value:function(t){var e=t.target.getAttribute(r.launchyCustom.refocus),n=document.querySelector("#"+e);if(null==n)throw Error(d.refocusElemNotFound+": #"+e);this.hideModal(t),n.focus()}},{key:"inertElements",value:function(t){var e=document.querySelectorAll(this.focusable),n=!0,o=!1,i=void 0;try{for(var a,r=Array.from(e)[Symbol.iterator]();!(n=(a=r.next()).done);n=!0){var s=a.value;this.modalOverlay===s||this.modalBumper===s||this.modalWindow.contains(s)||(s.inert=t)}}catch(t){o=!0,i=t}finally{try{!n&&r.return&&r.return()}finally{if(o)throw i}}}}]),t}(),c=function(){var t=document.querySelectorAll(l.launchyElements),e=null,n=null,o=null,i=!0,a=!1,s=void 0;try{for(var u,c=Array.from(t)[Symbol.iterator]();!(i=(u=c.next()).done);i=!0){var y=u.value;if(e=y.getAttribute(r.launchyText),n=y.getAttribute(r.launchyTitle),o=y.hasAttribute(r.launchyButton),!e)throw Error(d.modalError);if(""===e.trim())throw Error(d.modalErrorEmpty);n||console.warn(d.modalWarning);new h({target:y,text:e,title:n,button:o})}}catch(t){a=!0,s=t}finally{try{!i&&c.return&&c.return()}finally{if(a)throw s}}};document.addEventListener("DOMContentLoaded",c,!1),e.Launchy=h},function(t,e,n){!function(t,e){e()}(0,function(){"use strict";function t(t,e){var n=window.Element.prototype,o=n.matches||n.mozMatchesSelector||n.msMatchesSelector||n.oMatchesSelector||n.webkitMatchesSelector;if(!t||1!==t.nodeType)return!1;var i=t.parentNode;if(o)return o.call(t,e);for(var a=i.querySelectorAll(e),r=a.length,s=0;s
+ * @version 0.8.1
+ * @license MIT
+ */
+n(1);var a={modalLaunchLink:"launchy__launch-link",modalCloseLink:"launchy__close-link",modalWindow:"launchy__window",modalContent:"launchy__content",modalOverlay:"launchy__overlay",modalTitle:"launchy__title",modalWindowIsVisible:"launchy__window--is-visible",modalOverlayIsVisible:"launchy__overlay--is-visible"},r={launchyText:"data-launchy-text",launchyTitle:"data-launchy-title",launchyButton:"data-launchy-button",launchyCustom:{close:"data-launchy-close",refocus:"data-launchy-refocus"}},s={Escape:27},l={launchyElements:"[data-launchy]",launchyControl:"launchy-control-",launchyDialog:"launchy-dialog-",launchyCloseControl:"launchy-close-control-",modalOverlay:"modal-overlay-",modalBumper:"modal-bumper-",modalTitle:"modal-title-"},d={modalClose:"Close modal window!",modalCloseHTML:'×',modalError:"Launchy container must have a `data-launchy-text` attribute!",modalErrorEmpty:"Launchy container `data-launchy-text` attribute cannot be empty!",modalWarning:"Launchy container should have a `data-launchy-title` attribute, or be sure to supply your own heading! (Prefereably an ``.)",refocusElemNotFound:"Refocus element not found!"},u=0,h=function(){function t(e){o(this,t),this.focusable=n(2),this.launchyId=u,this.hasTitle=!!e.title,this.useButton=!!e.button,this.modalIsVisible=!1,this.activeElement=null,this.shiftKeyIsPressed=!1,this.allFocusable=null,this.firstFocusable=null,this.lastFocusable=null,this.domFocusable=null,this.createElements(e),this.insertElements(e),this.setupEventListeners(),u++}return i(t,[{key:"createElements",value:function(t){this.launchControl=document.createElement(this.useButton?"button":"a"),this.launchControl.id=""+l.launchyControl+this.launchyId,this.useButton?this.launchControl.type="button":this.launchControl.href="#"+l.launchyDialog+this.launchyId,this.launchControl.classList.add(a.modalLaunchLink),this.launchControl.setAttribute("aria-haspopup","dialog"),this.launchControl.textContent=t.text,this.closeControl=document.createElement(this.useButton?"button":"a"),this.closeControl.id=""+l.launchyCloseControl+this.launchyId,this.useButton?this.closeControl.type="button":this.closeControl.href="#"+l.launchyControl+this.launchyId,this.closeControl.classList.add(a.modalCloseLink),this.closeControl.setAttribute("aria-label",d.modalClose),this.closeControl.innerHTML=d.modalCloseHTML,this.modalWindow=document.createElement("div"),this.modalWindow.id=""+l.launchyDialog+this.launchyId,this.modalWindow.classList.add(a.modalWindow),this.modalWindow.setAttribute("tabindex",-1),this.modalWindow.setAttribute("role","dialog"),this.modalWindow.setAttribute("aria-modal",!0),this.hasTitle&&this.modalWindow.setAttribute("aria-labelledby",""+l.modalTitle+this.launchyId),this.modalOverlay=document.createElement("div"),this.modalOverlay.id=""+l.modalOverlay+this.launchyId,this.modalOverlay.classList.add(a.modalOverlay),this.modalOverlay.setAttribute("tabindex",-1),this.modalBumper=document.createElement("div"),this.modalBumper.id=""+l.modalBumper+this.launchyId,this.modalBumper.setAttribute("tabindex",-1),this.modalContent=document.createElement("div"),this.modalContent.classList.add(a.modalContent),this.hasTitle&&(this.modalTitle=document.createElement("h2"),this.modalTitle.id=""+l.modalTitle+this.launchyId,this.modalTitle.classList.add(a.modalTitle),this.modalTitle.textContent=t.title)}},{key:"insertElements",value:function(t){t.target.parentNode.insertBefore(this.launchControl,t.target),t.target.parentNode.insertBefore(this.modalWindow,t.target),this.modalWindow.appendChild(this.modalContent),this.modalContent.appendChild(this.closeControl),this.hasTitle&&this.modalContent.appendChild(this.modalTitle),this.modalContent.appendChild(t.target),document.body.appendChild(this.modalOverlay),document.body.insertBefore(this.modalBumper,document.body.firstChild)}},{key:"setupEventListeners",value:function(){var t=this.modalContent.querySelectorAll("["+r.launchyCustom.close+"]"),e=this.modalContent.querySelectorAll("["+r.launchyCustom.refocus+"]");this.launchControl.addEventListener("click",this.showModal.bind(this),!1),this.closeControl.addEventListener("click",this.hideModal.bind(this),!1),this.modalOverlay.addEventListener("click",this.hideModal.bind(this),!1),document.addEventListener("focus",this.trapFocus.bind(this),!0),document.addEventListener("keydown",this.checkEsc.bind(this),!1),document.addEventListener("keydown",this.checkShift.bind(this),!1);var n=!0,o=!1,i=void 0;try{for(var a,s=Array.from(t)[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){a.value.addEventListener("click",this.hideModal.bind(this),!1)}}catch(t){o=!0,i=t}finally{try{!n&&s.return&&s.return()}finally{if(o)throw i}}var l=!0,d=!1,u=void 0;try{for(var h,c=Array.from(e)[Symbol.iterator]();!(l=(h=c.next()).done);l=!0){h.value.addEventListener("click",this.hideModalRefocus.bind(this),!1)}}catch(t){d=!0,u=t}finally{try{!l&&c.return&&c.return()}finally{if(d)throw u}}}},{key:"showModal",value:function(t){t.preventDefault(),this.activeElement=document.activeElement,this.modalIsVisible=!0,this.allFocusable=this.modalWindow.querySelectorAll(this.focusable),this.firstFocusable=this.allFocusable[0],this.lastFocusable=this.allFocusable[this.allFocusable.length-1],this.modalWindow.classList.add(a.modalWindowIsVisible),this.modalOverlay.classList.add(a.modalOverlayIsVisible),this.inertElements(!0),this.modalOverlay.setAttribute("tabindex",0),this.modalBumper.setAttribute("tabindex",0),this.modalWindow.focus()}},{key:"hideModal",value:function(t){t.preventDefault(),this.modalIsVisible=!1,this.allFocusable=null,this.firstFocusable=null,this.lastFocusable=null,this.modalWindow.classList.remove(a.modalWindowIsVisible),this.modalOverlay.classList.remove(a.modalOverlayIsVisible),this.inertElements(!1),this.modalOverlay.setAttribute("tabindex",-1),this.modalBumper.setAttribute("tabindex",-1),this.activeElement.focus()}},{key:"trapFocus",value:function(t){this.modalIsVisible&&!this.modalWindow.contains(t.target)&&(t.stopPropagation(),this.shiftKeyIsPressed?this.lastFocusable.focus():this.firstFocusable.focus())}},{key:"checkEsc",value:function(t){this.modalIsVisible&&t.keyCode===s.Escape&&this.hideModal(t)}},{key:"checkShift",value:function(t){this.modalIsVisible&&(this.shiftKeyIsPressed=t.shiftKey)}},{key:"hideModalRefocus",value:function(t){var e=t.target.getAttribute(r.launchyCustom.refocus),n=document.querySelector("#"+e);if(null==n)throw Error(d.refocusElemNotFound+": #"+e);this.hideModal(t),n.focus()}},{key:"inertElements",value:function(t){var e=document.querySelectorAll(this.focusable),n=!0,o=!1,i=void 0;try{for(var a,r=Array.from(e)[Symbol.iterator]();!(n=(a=r.next()).done);n=!0){var s=a.value;this.modalOverlay===s||this.modalBumper===s||this.modalWindow.contains(s)||(s.inert=t)}}catch(t){o=!0,i=t}finally{try{!n&&r.return&&r.return()}finally{if(o)throw i}}}}]),t}(),c=function(){var t=document.querySelectorAll(l.launchyElements),e=null,n=null,o=null,i=!0,a=!1,s=void 0;try{for(var u,c=Array.from(t)[Symbol.iterator]();!(i=(u=c.next()).done);i=!0){var y=u.value;if(e=y.getAttribute(r.launchyText),n=y.getAttribute(r.launchyTitle),o=y.hasAttribute(r.launchyButton),!e)throw Error(d.modalError);if(""===e.trim())throw Error(d.modalErrorEmpty);n||console.warn(d.modalWarning);new h({target:y,text:e,title:n,button:o})}}catch(t){a=!0,s=t}finally{try{!i&&c.return&&c.return()}finally{if(a)throw s}}};document.addEventListener("DOMContentLoaded",c,!1),e.Launchy=h},function(t,e,n){!function(t,e){e()}(0,function(){"use strict";function t(t,e){var n=window.Element.prototype,o=n.matches||n.mozMatchesSelector||n.msMatchesSelector||n.oMatchesSelector||n.webkitMatchesSelector;if(!t||1!==t.nodeType)return!1;var i=t.parentNode;if(o)return o.call(t,e);for(var a=i.querySelectorAll(e),r=a.length,s=0;s
- * @version 0.8.1
- * @license MIT
- */
-n(1);var a={modalLaunchLink:"launchy__launch-link",modalCloseLink:"launchy__close-link",modalWindow:"launchy__window",modalContent:"launchy__content",modalOverlay:"launchy__overlay",modalTitle:"launchy__title",modalWindowIsVisible:"launchy__window--is-visible",modalOverlayIsVisible:"launchy__overlay--is-visible"},r={launchyText:"data-launchy-text",launchyTitle:"data-launchy-title",launchyButton:"data-launchy-button",launchyCustom:{close:"data-launchy-close",refocus:"data-launchy-refocus"}},s={Escape:27},l={launchyElements:"[data-launchy]",launchyControl:"launchy-control-",launchyDialog:"launchy-dialog-",launchyCloseControl:"launchy-close-control-",modalOverlay:"modal-overlay-",modalBumper:"modal-bumper-",modalTitle:"modal-title-"},d={modalClose:"Close modal window!",modalCloseHTML:'×',modalError:"Launchy container must have a `data-launchy-text` attribute!",modalErrorEmpty:"Launchy container `data-launchy-text` attribute cannot be empty!",modalWarning:"Launchy container should have a `data-launchy-title` attribute, or be sure to supply your own heading! (Prefereably an ``.)",refocusElemNotFound:"Refocus element not found!"},u=0,h=function(){function t(e){o(this,t),this.focusable=n(2),this.launchyId=u,this.hasTitle=!!e.title,this.useButton=!!e.button,this.modalIsVisible=!1,this.activeElement=null,this.shiftKeyIsPressed=!1,this.allFocusable=null,this.firstFocusable=null,this.lastFocusable=null,this.domFocusable=null,this.createElements(e),this.insertElements(e),this.setupEventListeners(),u++}return i(t,[{key:"createElements",value:function(t){console.log(this.useButton),this.launchControl=document.createElement(this.useButton?"button":"a"),this.launchControl.id=""+l.launchyControl+this.launchyId,this.useButton?this.launchControl.type="button":this.launchControl.href="#"+l.launchyDialog+this.launchyId,this.launchControl.classList.add(a.modalLaunchLink),this.launchControl.setAttribute("aria-haspopup","dialog"),this.launchControl.textContent=t.text,this.closeControl=document.createElement(this.useButton?"button":"a"),this.closeControl.id=""+l.launchyCloseControl+this.launchyId,this.useButton?this.closeControl.type="button":this.closeControl.href="#"+l.launchyControl+this.launchyId,this.closeControl.classList.add(a.modalCloseLink),this.closeControl.setAttribute("aria-label",d.modalClose),this.closeControl.innerHTML=d.modalCloseHTML,this.modalWindow=document.createElement("div"),this.modalWindow.id=""+l.launchyDialog+this.launchyId,this.modalWindow.classList.add(a.modalWindow),this.modalWindow.setAttribute("tabindex",-1),this.modalWindow.setAttribute("role","dialog"),this.modalWindow.setAttribute("aria-modal",!0),this.hasTitle&&this.modalWindow.setAttribute("aria-labelledby",""+l.modalTitle+this.launchyId),this.modalOverlay=document.createElement("div"),this.modalOverlay.id=""+l.modalOverlay+this.launchyId,this.modalOverlay.classList.add(a.modalOverlay),this.modalOverlay.setAttribute("tabindex",0),this.modalBumper=document.createElement("div"),this.modalBumper.id=""+l.modalBumper+this.launchyId,this.modalBumper.setAttribute("tabindex",0),this.modalContent=document.createElement("div"),this.modalContent.classList.add(a.modalContent),this.hasTitle&&(this.modalTitle=document.createElement("h2"),this.modalTitle.id=""+l.modalTitle+this.launchyId,this.modalTitle.classList.add(a.modalTitle),this.modalTitle.textContent=t.title)}},{key:"insertElements",value:function(t){t.target.parentNode.insertBefore(this.launchControl,t.target),t.target.parentNode.insertBefore(this.modalWindow,t.target),this.modalWindow.appendChild(this.modalContent),this.modalContent.appendChild(this.closeControl),this.hasTitle&&this.modalContent.appendChild(this.modalTitle),this.modalContent.appendChild(t.target),document.body.appendChild(this.modalOverlay),document.body.insertBefore(this.modalBumper,document.body.firstChild)}},{key:"setupEventListeners",value:function(){var t=this.modalContent.querySelectorAll("["+r.launchyCustom.close+"]"),e=this.modalContent.querySelectorAll("["+r.launchyCustom.refocus+"]");this.launchControl.addEventListener("click",this.showModal.bind(this),!1),this.closeControl.addEventListener("click",this.hideModal.bind(this),!1),this.modalOverlay.addEventListener("click",this.hideModal.bind(this),!1),document.addEventListener("focus",this.trapFocus.bind(this),!0),document.addEventListener("keydown",this.checkEsc.bind(this),!1),document.addEventListener("keydown",this.checkShift.bind(this),!1);var n=!0,o=!1,i=void 0;try{for(var a,s=Array.from(t)[Symbol.iterator]();!(n=(a=s.next()).done);n=!0){a.value.addEventListener("click",this.hideModal.bind(this),!1)}}catch(t){o=!0,i=t}finally{try{!n&&s.return&&s.return()}finally{if(o)throw i}}var l=!0,d=!1,u=void 0;try{for(var h,c=Array.from(e)[Symbol.iterator]();!(l=(h=c.next()).done);l=!0){h.value.addEventListener("click",this.hideModalRefocus.bind(this),!1)}}catch(t){d=!0,u=t}finally{try{!l&&c.return&&c.return()}finally{if(d)throw u}}}},{key:"showModal",value:function(t){t.preventDefault(),this.activeElement=document.activeElement,this.modalIsVisible=!0,this.allFocusable=this.modalWindow.querySelectorAll(this.focusable),this.firstFocusable=this.allFocusable[0],this.lastFocusable=this.allFocusable[this.allFocusable.length-1],this.modalWindow.classList.add(a.modalWindowIsVisible),this.modalOverlay.classList.add(a.modalOverlayIsVisible),this.inertElements(!0),this.modalWindow.focus()}},{key:"hideModal",value:function(t){t.preventDefault(),this.modalIsVisible=!1,this.allFocusable=null,this.firstFocusable=null,this.lastFocusable=null,this.modalWindow.classList.remove(a.modalWindowIsVisible),this.modalOverlay.classList.remove(a.modalOverlayIsVisible),this.inertElements(!1),this.activeElement.focus()}},{key:"trapFocus",value:function(t){this.modalIsVisible&&!this.modalWindow.contains(t.target)&&(t.stopPropagation(),this.shiftKeyIsPressed?this.lastFocusable.focus():this.firstFocusable.focus())}},{key:"checkEsc",value:function(t){this.modalIsVisible&&t.keyCode===s.Escape&&this.hideModal(t)}},{key:"checkShift",value:function(t){this.modalIsVisible&&(this.shiftKeyIsPressed=t.shiftKey)}},{key:"hideModalRefocus",value:function(t){var e=t.target.getAttribute(r.launchyCustom.refocus),n=document.querySelector("#"+e);if(null==n)throw Error(d.refocusElemNotFound+": #"+e);this.hideModal(t),n.focus()}},{key:"inertElements",value:function(t){var e=document.querySelectorAll(this.focusable),n=!0,o=!1,i=void 0;try{for(var a,r=Array.from(e)[Symbol.iterator]();!(n=(a=r.next()).done);n=!0){var s=a.value;this.modalOverlay===s||this.modalBumper===s||this.modalWindow.contains(s)||(s.inert=t)}}catch(t){o=!0,i=t}finally{try{!n&&r.return&&r.return()}finally{if(o)throw i}}}}]),t}(),c=function(){var t=document.querySelectorAll(l.launchyElements),e=null,n=null,o=null,i=!0,a=!1,s=void 0;try{for(var u,c=Array.from(t)[Symbol.iterator]();!(i=(u=c.next()).done);i=!0){var y=u.value;if(e=y.getAttribute(r.launchyText),n=y.getAttribute(r.launchyTitle),o=y.hasAttribute(r.launchyButton),!e)throw Error(d.modalError);if(""===e.trim())throw Error(d.modalErrorEmpty);n||console.warn(d.modalWarning);new h({target:y,text:e,title:n,button:o})}}catch(t){a=!0,s=t}finally{try{!i&&c.return&&c.return()}finally{if(a)throw s}}};document.addEventListener("DOMContentLoaded",c,!1),e.Launchy=h},function(t,e,n){!function(t,e){e()}(0,function(){"use strict";function t(t,e){var n=window.Element.prototype,o=n.matches||n.mozMatchesSelector||n.msMatchesSelector||n.oMatchesSelector||n.webkitMatchesSelector;if(!t||1!==t.nodeType)return!1;var i=t.parentNode;if(o)return o.call(t,e);for(var a=i.querySelectorAll(e),r=a.length,s=0;s×',
- modalError: 'Launchy container must have a `data-launchy-text` attribute!',
- modalErrorEmpty: 'Launchy container `data-launchy-text` attribute cannot be empty!',
- modalWarning: 'Launchy container should have a `data-launchy-title` attribute, or be sure to supply your own heading! (Prefereably an ``.)',
- refocusElemNotFound: 'Refocus element not found!'
+ modalClose: 'Close modal window!',
+ modalCloseHTML: '×',
+ modalError: 'Launchy container must have a `data-launchy-text` attribute!',
+ modalErrorEmpty:
+ 'Launchy container `data-launchy-text` attribute cannot be empty!',
+ modalWarning:
+ 'Launchy container should have a `data-launchy-title` attribute, or be sure to supply your own heading! (Prefereably an ``.)',
+ refocusElemNotFound: 'Refocus element not found!'
};
// Unique identifier
let launchyId = 0;
class Launchy {
- constructor(params) {
-
- // https://www.npmjs.com/package/focusable
- this.focusable = require('focusable');
-
- // Unique identifier for each instance
- this.launchyId = launchyId;
-
- // Flags and other objects to be used later
- this.hasTitle = params.title ? true : false;
- this.useButton = params.button ? true : false;
- this.modalIsVisible = false;
- this.activeElement = null;
- this.shiftKeyIsPressed = false;
- this.allFocusable = null;
- this.firstFocusable = null;
- this.lastFocusable = null;
- this.domFocusable = null;
-
- // Setup all the things
- // this.prepareFocusable();
- this.createElements(params);
- this.insertElements(params);
- this.setupEventListeners();
-
- // Increment identifier
- launchyId++;
+ constructor(params) {
+
+ // https://www.npmjs.com/package/focusable
+ this.focusable = require('focusable');
+
+ // Unique identifier for each instance
+ this.launchyId = launchyId;
+
+ // Flags and other objects to be used later
+ this.hasTitle = params.title ? true : false;
+ this.useButton = params.button ? true : false;
+ this.modalIsVisible = false;
+ this.activeElement = null;
+ this.shiftKeyIsPressed = false;
+ this.allFocusable = null;
+ this.firstFocusable = null;
+ this.lastFocusable = null;
+ this.domFocusable = null;
+
+ // Setup all the things
+ // this.prepareFocusable();
+ this.createElements(params);
+ this.insertElements(params);
+ this.setupEventListeners();
+
+ // Increment identifier
+ launchyId++;
+ }
+
+ /**
+ * Create all the required elements for Launchy to function.
+ *
+ * @param {Object} params Instance parameters
+ * @return {null}
+ */
+ createElements(params) {
+
+ // Launch control
+ this.launchControl = document.createElement(
+ this.useButton ? 'button' : 'a'
+ );
+ this.launchControl.id = `${selectors.launchyControl}${this.launchyId}`;
+ this.useButton
+ ? this.launchControl.type = 'button'
+ : this.launchControl.href = `#${selectors.launchyDialog}${
+ this.launchyId
+ }`;
+ this.launchControl.classList.add(classes.modalLaunchLink);
+ this.launchControl.setAttribute('aria-haspopup', 'dialog');
+ this.launchControl.textContent = params.text;
+
+ // Close control
+ this.closeControl = document.createElement(this.useButton ? 'button' : 'a');
+ this.closeControl.id = `${selectors.launchyCloseControl}${this.launchyId}`;
+ this.useButton
+ ? this.closeControl.type = 'button'
+ : this.closeControl.href = `#${selectors.launchyControl}${
+ this.launchyId
+ }`;
+ this.closeControl.classList.add(classes.modalCloseLink);
+ this.closeControl.setAttribute('aria-label', strings.modalClose);
+ this.closeControl.innerHTML = strings.modalCloseHTML;
+
+ // Modal window
+ this.modalWindow = document.createElement('div');
+ this.modalWindow.id = `${selectors.launchyDialog}${this.launchyId}`;
+ this.modalWindow.classList.add(classes.modalWindow);
+ this.modalWindow.setAttribute('tabindex', -1);
+ this.modalWindow.setAttribute('role', 'dialog');
+ this.modalWindow.setAttribute('aria-modal', true);
+
+ if (this.hasTitle) {
+ this.modalWindow.setAttribute(
+ 'aria-labelledby',
+ `${selectors.modalTitle}${this.launchyId}`
+ );
}
- /**
- * Create all the required elements for Launchy to function.
- *
- * @param {Object} params Instance parameters
- * @return {null}
- */
- createElements(params) {
- console.log(this.useButton);
-
- // Launch control
- this.launchControl = document.createElement(this.useButton ? 'button' : 'a');
- this.launchControl.id = `${selectors.launchyControl}${this.launchyId}`;
- this.useButton ? this.launchControl.type = 'button' : this.launchControl.href = `#${selectors.launchyDialog}${this.launchyId}`;
- this.launchControl.classList.add(classes.modalLaunchLink);
- this.launchControl.setAttribute('aria-haspopup', 'dialog');
- this.launchControl.textContent = params.text;
-
- // Close control
- this.closeControl = document.createElement(this.useButton ? 'button' : 'a');
- this.closeControl.id = `${selectors.launchyCloseControl}${this.launchyId}`;
- this.useButton ? this.closeControl.type = 'button' : this.closeControl.href = `#${selectors.launchyControl}${this.launchyId}`;
- this.closeControl.classList.add(classes.modalCloseLink);
- this.closeControl.setAttribute('aria-label', strings.modalClose);
- this.closeControl.innerHTML = strings.modalCloseHTML;
-
- // Modal window
- this.modalWindow = document.createElement('div');
- this.modalWindow.id = `${selectors.launchyDialog}${this.launchyId}`;
- this.modalWindow.classList.add(classes.modalWindow);
- this.modalWindow.setAttribute('tabindex', -1);
- this.modalWindow.setAttribute('role', 'dialog');
- this.modalWindow.setAttribute('aria-modal', true);
-
- if (this.hasTitle) {
- this.modalWindow.setAttribute('aria-labelledby', `${selectors.modalTitle}${this.launchyId}`);
- }
-
- // Modal overlay
- this.modalOverlay = document.createElement('div');
- this.modalOverlay.id = `${selectors.modalOverlay}${this.launchyId}`;
- this.modalOverlay.classList.add(classes.modalOverlay);
- this.modalOverlay.setAttribute('tabindex', 0);
-
- // Modal bumper
- this.modalBumper = document.createElement('div');
- this.modalBumper.id = `${selectors.modalBumper}${this.launchyId}`;
- this.modalBumper.setAttribute('tabindex', 0);
-
- // Modal content
- this.modalContent = document.createElement('div');
- this.modalContent.classList.add(classes.modalContent);
-
- // Modal title
- if (this.hasTitle) {
- this.modalTitle = document.createElement('h2');
- this.modalTitle.id = `${selectors.modalTitle}${this.launchyId}`;
- this.modalTitle.classList.add(classes.modalTitle);
- this.modalTitle.textContent = params.title;
- }
+ // Modal overlay
+ this.modalOverlay = document.createElement('div');
+ this.modalOverlay.id = `${selectors.modalOverlay}${this.launchyId}`;
+ this.modalOverlay.classList.add(classes.modalOverlay);
+ this.modalOverlay.setAttribute('tabindex', -1);
+
+ // Modal bumper
+ this.modalBumper = document.createElement('div');
+ this.modalBumper.id = `${selectors.modalBumper}${this.launchyId}`;
+ this.modalBumper.setAttribute('tabindex', -1);
+
+ // Modal content
+ this.modalContent = document.createElement('div');
+ this.modalContent.classList.add(classes.modalContent);
+
+ // Modal title
+ if (this.hasTitle) {
+ this.modalTitle = document.createElement('h2');
+ this.modalTitle.id = `${selectors.modalTitle}${this.launchyId}`;
+ this.modalTitle.classList.add(classes.modalTitle);
+ this.modalTitle.textContent = params.title;
}
+ }
- /**
- * Insert Launchy elements into the DOM.
- *
- * @param {Object} params instance parameters
- * @return {null}
- */
- insertElements(params) {
-
- // Launch control
- params.target.parentNode.insertBefore(this.launchControl, params.target);
-
- // Modal window
- params.target.parentNode.insertBefore(this.modalWindow, params.target);
+ /**
+ * Insert Launchy elements into the DOM.
+ *
+ * @param {Object} params instance parameters
+ * @return {null}
+ */
+ insertElements(params) {
- // Modal content container
- this.modalWindow.appendChild(this.modalContent);
+ // Launch control
+ params.target.parentNode.insertBefore(this.launchControl, params.target);
- // Close control
- this.modalContent.appendChild(this.closeControl);
+ // Modal window
+ params.target.parentNode.insertBefore(this.modalWindow, params.target);
- // Modal title
- if (this.hasTitle) {
- this.modalContent.appendChild(this.modalTitle);
- }
+ // Modal content container
+ this.modalWindow.appendChild(this.modalContent);
- // Move the content within the modal container
- this.modalContent.appendChild(params.target);
+ // Close control
+ this.modalContent.appendChild(this.closeControl);
- // Overlay
- document.body.appendChild(this.modalOverlay);
-
- // Bumper
- document.body.insertBefore(this.modalBumper, document.body.firstChild);
+ // Modal title
+ if (this.hasTitle) {
+ this.modalContent.appendChild(this.modalTitle);
}
- /**
- * Create event listeners for Launchy functionality.
- *
- * @return {null}
- */
- setupEventListeners() {
-
- // Gather any custom close or refocus controls
- const closeControls = this.modalContent.querySelectorAll(`[${data.launchyCustom.close}]`);
- const refocusControls = this.modalContent.querySelectorAll(`[${data.launchyCustom.refocus}]`);
-
- // Show the modal window on the launcher element `click` event
- this.launchControl.addEventListener('click', this.showModal.bind(this), false);
-
- // Hide the modal window on close button or overlay `click` event
- this.closeControl.addEventListener('click', this.hideModal.bind(this), false);
- this.modalOverlay.addEventListener('click', this.hideModal.bind(this), false);
-
- // Trap the keyboard focus within modal window on the document
- // `focus` event. Notice the use of the `useCapture` flag set to `true`; this
- // indicates the event will be dispatched to the listener before any event
- // target in the DOM:
- // https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener
- document.addEventListener('focus', this.trapFocus.bind(this), true);
-
- // Check for `esc` key press on the document `keydown` event
- document.addEventListener('keydown', this.checkEsc.bind(this), false);
-
- // Check for `shift` key press on the document `keydown` event
- document.addEventListener('keydown', this.checkShift.bind(this), false);
-
- // Add event listener for all custom close controls
- for (const closeControl of Array.from(closeControls)) {
- closeControl.addEventListener('click', this.hideModal.bind(this), false);
- }
-
- // Add event listener for all custom refocus controls
- for (const refocusControl of Array.from(refocusControls)) {
- refocusControl.addEventListener('click', this.hideModalRefocus.bind(this), false);
- }
+ // Move the content within the modal container
+ this.modalContent.appendChild(params.target);
+
+ // Overlay
+ document.body.appendChild(this.modalOverlay);
+
+ // Bumper
+ document.body.insertBefore(this.modalBumper, document.body.firstChild);
+ }
+
+ /**
+ * Create event listeners for Launchy functionality.
+ *
+ * @return {null}
+ */
+ setupEventListeners() {
+
+ // Gather any custom close or refocus controls
+ const closeControls = this.modalContent.querySelectorAll(
+ `[${data.launchyCustom.close}]`
+ );
+ const refocusControls = this.modalContent.querySelectorAll(
+ `[${data.launchyCustom.refocus}]`
+ );
+
+ // Show the modal window on the launcher element `click` event
+ this.launchControl.addEventListener(
+ 'click',
+ this.showModal.bind(this),
+ false
+ );
+
+ // Hide the modal window on close button or overlay `click` event
+ this.closeControl.addEventListener(
+ 'click',
+ this.hideModal.bind(this),
+ false
+ );
+ this.modalOverlay.addEventListener(
+ 'click',
+ this.hideModal.bind(this),
+ false
+ );
+
+ // Trap the keyboard focus within modal window on the document
+ // `focus` event. Notice the use of the `useCapture` flag set to `true`; this
+ // indicates the event will be dispatched to the listener before any event
+ // target in the DOM:
+ // https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener
+ document.addEventListener('focus', this.trapFocus.bind(this), true);
+
+ // Check for `esc` key press on the document `keydown` event
+ document.addEventListener('keydown', this.checkEsc.bind(this), false);
+
+ // Check for `shift` key press on the document `keydown` event
+ document.addEventListener('keydown', this.checkShift.bind(this), false);
+
+ // Add event listener for all custom close controls
+ for (const closeControl of Array.from(closeControls)) {
+ closeControl.addEventListener('click', this.hideModal.bind(this), false);
}
- /**
- * Show the modal window.
- *
- * @param {Object} e The event object
- * @return {null}
- */
- showModal(e) {
- e.preventDefault();
-
- // Cache the last active element
- this.activeElement = document.activeElement;
-
- // Set visible flag as `true`
- this.modalIsVisible = true;
-
- // Set the focusable objects, first and last, within the modal window
- this.allFocusable = this.modalWindow.querySelectorAll(this.focusable);
- this.firstFocusable = this.allFocusable[0];
- this.lastFocusable = this.allFocusable[this.allFocusable.length - 1];
-
- // Add the `active` classes
- this.modalWindow.classList.add(classes.modalWindowIsVisible);
- this.modalOverlay.classList.add(classes.modalOverlayIsVisible);
-
- // Set focusable elements as "inert"
- this.inertElements(true);
-
- // Shift keyboard focus to the modal window container
- this.modalWindow.focus();
- };
-
- /**
- * Hide the modal window.
- *
- * @param {Object} e The event object
- * @return {null}
- */
- hideModal(e) {
- e.preventDefault();
-
- // Set visible flag to `false`
- this.modalIsVisible = false;
-
- // Reset the focusable objects
- this.allFocusable = null;
- this.firstFocusable = null;
- this.lastFocusable = null;
+ // Add event listener for all custom refocus controls
+ for (const refocusControl of Array.from(refocusControls)) {
+ refocusControl.addEventListener(
+ 'click',
+ this.hideModalRefocus.bind(this),
+ false
+ );
+ }
+ }
+
+ /**
+ * Show the modal window.
+ *
+ * @param {Object} e The event object
+ * @return {null}
+ */
+ showModal(e) {
+ e.preventDefault();
+
+ // Cache the last active element
+ this.activeElement = document.activeElement;
+
+ // Set visible flag as `true`
+ this.modalIsVisible = true;
+
+ // Set the focusable objects, first and last, within the modal window
+ this.allFocusable = this.modalWindow.querySelectorAll(this.focusable);
+ this.firstFocusable = this.allFocusable[0];
+ this.lastFocusable = this.allFocusable[this.allFocusable.length - 1];
+
+ // Add the `active` classes
+ this.modalWindow.classList.add(classes.modalWindowIsVisible);
+ this.modalOverlay.classList.add(classes.modalOverlayIsVisible);
+
+ // Set focusable elements as "inert"
+ this.inertElements(true);
+
+ // Set "bumpers" to be focusable
+ this.modalOverlay.setAttribute('tabindex', 0);
+ this.modalBumper.setAttribute('tabindex', 0);
+
+ // Shift keyboard focus to the modal window container
+ this.modalWindow.focus();
+ }
+
+ /**
+ * Hide the modal window.
+ *
+ * @param {Object} e The event object
+ * @return {null}
+ */
+ hideModal(e) {
+ e.preventDefault();
+
+ // Set visible flag to `false`
+ this.modalIsVisible = false;
+
+ // Reset the focusable objects
+ this.allFocusable = null;
+ this.firstFocusable = null;
+ this.lastFocusable = null;
+
+ // Remove the `active` classes
+ this.modalWindow.classList.remove(classes.modalWindowIsVisible);
+ this.modalOverlay.classList.remove(classes.modalOverlayIsVisible);
+
+ // Remove "inert" state for focusable elements
+ this.inertElements(false);
+
+ // Set "bumpers" to be not focusable
+ this.modalOverlay.setAttribute('tabindex', -1);
+ this.modalBumper.setAttribute('tabindex', -1);
+
+ // Set focus to the previous active element
+ this.activeElement.focus();
+ }
+
+ /**
+ * Trap keyboard focus within the modal window.
+ *
+ * @param {Object} e The event object
+ * @return {null}
+ */
+ trapFocus(e) {
+
+ // If the modal is currently visible _and_ the currently focused element
+ // is _not_ within the modal window…
+ if (this.modalIsVisible && !this.modalWindow.contains(e.target)) {
+
+ // Stop the event from bubbling any further up into the DOM:
+ // https://developer.mozilla.org/en-US/docs/Web/API/Event/stopPropagation
+ e.stopPropagation();
+
+ // If the user is moving forward, focus on the first element,
+ // otherwise, the `shift` key is pressed; focus on the last element
+ this.shiftKeyIsPressed
+ ? this.lastFocusable.focus()
+ : this.firstFocusable.focus();
+ }
+ }
+
+ /**
+ * Check if the `esc` key has been pressed.
+ *
+ * @param {Object} e The event object
+ * @return {null}
+ */
+ checkEsc(e) {
+ if (this.modalIsVisible) {
+
+ // Hide the modal window on `esc` key press
+ if (e.keyCode === keysCodes.Escape) {
+ this.hideModal(e);
+ }
+ }
+ }
+
+ /**
+ * Check if the `shift` key is being being pressed.
+ *
+ * @param {Object} e The event object
+ * @return {null}
+ */
+ checkShift(e) {
+ if (this.modalIsVisible) {
+
+ // Cache the `shift` key state
+ this.shiftKeyIsPressed = e.shiftKey;
+ }
+ }
+
+ /**
+ * Send focus to the specified element `id` on custom refocus element click
+ *
+ * @param {Object} e The event object
+ * @return {null}
+ */
+ hideModalRefocus(e) {
+ const refocusId = e.target.getAttribute(data.launchyCustom.refocus);
+ const refocusElem = document.querySelector(`#${refocusId}`);
+
+ // Throw an error if the refocus element is not found
+ if (refocusElem == null) {
+ throw Error(`${strings.refocusElemNotFound}: #${refocusId}`);
+ return;
+ }
- // Remove the `active` classes
- this.modalWindow.classList.remove(classes.modalWindowIsVisible);
- this.modalOverlay.classList.remove(classes.modalOverlayIsVisible);
+ // Hide the modal
+ this.hideModal(e);
+
+ // Send focus to the specified element
+ refocusElem.focus();
+ }
+
+ /**
+ * Set all existing focusable elements as "inert" -- hide from screen
+ * readers in order to keep focus trapped within modal when using other
+ * forms of keyboard navigation (other than tab).
+ *
+ * @param {Boolean} isInert Flag to set elements "inert" state
+ * @return {null}
+ */
+ inertElements(isInert) {
+
+ // Select all focusable elements
+ const focusable = document.querySelectorAll(this.focusable);
+
+ for (const elem of Array.from(focusable)) {
+
+ // Do not apply `inert` to the overlay, bumper, or any elements
+ // within the modal itself
+ if (
+ this.modalOverlay !== elem &&
+ this.modalBumper !== elem &&
+ !this.modalWindow.contains(elem)
+ ) {
+ elem.inert = isInert;
+ }
+ }
+ }
+}
- // Remove "inert" state for focusable elements
- this.inertElements(false);
+const init = () => {
- // Set focus to the previous active element
- this.activeElement.focus();
- };
+ // Create instances per `data-launchy` elements found in the DOM
+ const launchyElements = document.querySelectorAll(selectors.launchyElements);
- /**
- * Trap keyboard focus within the modal window.
- *
- * @param {Object} e The event object
- * @return {null}
- */
- trapFocus(e) {
-
- // If the modal is currently visible _and_ the currently focused element
- // is _not_ within the modal window…
- if (this.modalIsVisible && !this.modalWindow.contains(e.target)) {
-
- // Stop the event from bubbling any further up into the DOM:
- // https://developer.mozilla.org/en-US/docs/Web/API/Event/stopPropagation
- e.stopPropagation();
-
- // If the user is moving forward, focus on the first element,
- // otherwise, the `shift` key is pressed; focus on the last element
- this.shiftKeyIsPressed ? this.lastFocusable.focus() : this.firstFocusable.focus();
- }
- };
+ let launchyText = null,
+ launchyTitle = null,
+ launchyButton = null;
- /**
- * Check if the `esc` key has been pressed.
- *
- * @param {Object} e The event object
- * @return {null}
- */
- checkEsc(e) {
- if (this.modalIsVisible) {
-
- // Hide the modal window on `esc` key press
- if (e.keyCode === keysCodes.Escape) {
- this.hideModal(e);
- }
- }
- };
+ for (const launchyElement of Array.from(launchyElements)) {
+ launchyText = launchyElement.getAttribute(data.launchyText),
+ launchyTitle = launchyElement.getAttribute(data.launchyTitle),
+ launchyButton = launchyElement.hasAttribute(data.launchyButton);
- /**
- * Check if the `shift` key is being being pressed.
- *
- * @param {Object} e The event object
- * @return {null}
- */
- checkShift(e) {
- if (this.modalIsVisible) {
-
- // Cache the `shift` key state
- this.shiftKeyIsPressed = e.shiftKey;
- }
- };
+ // Throw an error if there's no launcher control text attribute
+ if (!launchyText) {
+ throw Error(strings.modalError);
+ break;
+ }
- /**
- * Send focus to the specified element `id` on custom refocus element click
- *
- * @param {Object} e The event object
- * @return {null}
- */
- hideModalRefocus(e) {
- const refocusId = e.target.getAttribute(data.launchyCustom.refocus);
- const refocusElem = document.querySelector(`#${refocusId}`);
-
- // Throw an error if the refocus element is not found
- if (refocusElem == null) {
- throw Error(`${strings.refocusElemNotFound}: #${refocusId}`);
- return;
- }
-
- // Hide the modal
- this.hideModal(e);
+ // Throw an error if the launcher control text is empty
+ if (launchyText.trim() === '') {
+ throw Error(strings.modalErrorEmpty);
+ break;
+ }
- // Send focus to the specified element
- refocusElem.focus();
- };
+ // Throw a warning if there's no heading title text
+ if (!launchyTitle) {
+ console.warn(strings.modalWarning);
+ }
- /**
- * Set all existing focusable elements as "inert" -- hide from screen
- * readers in order to keep focus trapped within modal when using other
- * forms of keyboard navigation (other than tab).
- *
- * @param {Boolean} isInert Flag to set elements "inert" state
- * @return {null}
- */
- inertElements(isInert) {
-
- // Select all focusable elements
- const focusable = document.querySelectorAll(this.focusable);
-
- for (const elem of Array.from(focusable)) {
-
- // Do not apply `inert` to the overlay, bumper, or any elements
- // within the modal itself
- if (this.modalOverlay !== elem && this.modalBumper !== elem && !this.modalWindow.contains(elem)) {
- elem.inert = isInert;
- }
- }
+ // Params object to send to Launchy constructor
+ const params = {
+ target: launchyElement,
+ text: launchyText,
+ title: launchyTitle,
+ button: launchyButton
};
-}
-
-const init = () => {
- // Create instances per `data-launchy` elements found in the DOM
- const launchyElements = document.querySelectorAll(selectors.launchyElements);
-
- let launchyText = null,
- launchyTitle = null,
- launchyButton = null;
-
- for (const launchyElement of Array.from(launchyElements)) {
- launchyText = launchyElement.getAttribute(data.launchyText),
- launchyTitle = launchyElement.getAttribute(data.launchyTitle),
- launchyButton = launchyElement.hasAttribute(data.launchyButton);
-
- // Throw an error if there's no launcher control text attribute
- if (!launchyText) {
- throw Error(strings.modalError);
- break;
- }
-
- // Throw an error if the launcher control text is empty
- if (launchyText.trim() === '') {
- throw Error(strings.modalErrorEmpty);
- break;
- }
-
- // Throw a warning if there's no heading title text
- if (!launchyTitle) {
- console.warn(strings.modalWarning);
- }
-
- // Params object to send to Launchy constructor
- const params = {
- target: launchyElement,
- text: launchyText,
- title: launchyTitle,
- button: launchyButton
- };
-
- // Create a new instance for each found in the DOM
- new Launchy(params);
- }
+ // Create a new instance for each found in the DOM
+ new Launchy(params);
+ }
};
document.addEventListener('DOMContentLoaded', init, false);
diff --git a/webpack.config.js b/webpack.config.js
index 2605232..c1115a5 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -1,26 +1,28 @@
const WebpackShellPlugin = require('webpack-shell-plugin');
-module.exports = [{
+module.exports = [
+ {
entry: './src/launchy.js',
output: {
- filename: './dist/launchy.js',
- library: 'Launchy'
+ filename: './dist/launchy.js',
+ library: 'Launchy'
},
module: {
- loaders: [
- {
- test: /\.js$/,
- exclude: /node_modules/,
- loader: 'babel-loader',
- query: {
- presets: ['es2015']
- }
- }
- ]
+ loaders: [
+ {
+ test: /\.js$/,
+ exclude: /node_modules/,
+ loader: 'babel-loader',
+ query: {
+ presets: ['env']
+ }
+ }
+ ]
},
plugins: [
- new WebpackShellPlugin({
- onBuildExit: ['npm run copy-to-brochure', 'npm run reload']
- })
+ new WebpackShellPlugin({
+ onBuildExit: ['npm run copy-to-brochure', 'npm run reload']
+ })
]
-}];
+ }
+];