foundation.reveal.js 50 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275
  1. (function webpackUniversalModuleDefinition(root, factory) {
  2. if(typeof exports === 'object' && typeof module === 'object')
  3. module.exports = factory(require("./foundation.core"), require("./foundation.util.keyboard"), require("./foundation.util.mediaQuery"), require("./foundation.util.motion"), require("./foundation.util.touch"), require("jquery"));
  4. else if(typeof define === 'function' && define.amd)
  5. define(["./foundation.core", "./foundation.util.keyboard", "./foundation.util.mediaQuery", "./foundation.util.motion", "./foundation.util.touch", "jquery"], factory);
  6. else if(typeof exports === 'object')
  7. exports["foundation.reveal"] = factory(require("./foundation.core"), require("./foundation.util.keyboard"), require("./foundation.util.mediaQuery"), require("./foundation.util.motion"), require("./foundation.util.touch"), require("jquery"));
  8. else
  9. root["__FOUNDATION_EXTERNAL__"] = root["__FOUNDATION_EXTERNAL__"] || {}, root["__FOUNDATION_EXTERNAL__"]["foundation.reveal"] = factory(root["__FOUNDATION_EXTERNAL__"]["foundation.core"], root["__FOUNDATION_EXTERNAL__"]["foundation.util.keyboard"], root["__FOUNDATION_EXTERNAL__"]["foundation.util.mediaQuery"], root["__FOUNDATION_EXTERNAL__"]["foundation.util.motion"], root["__FOUNDATION_EXTERNAL__"]["foundation.util.touch"], root["jQuery"]);
  10. })(window, function(__WEBPACK_EXTERNAL_MODULE__foundation_core__, __WEBPACK_EXTERNAL_MODULE__foundation_util_keyboard__, __WEBPACK_EXTERNAL_MODULE__foundation_util_mediaQuery__, __WEBPACK_EXTERNAL_MODULE__foundation_util_motion__, __WEBPACK_EXTERNAL_MODULE__foundation_util_touch__, __WEBPACK_EXTERNAL_MODULE_jquery__) {
  11. return /******/ (function(modules) { // webpackBootstrap
  12. /******/ // The module cache
  13. /******/ var installedModules = {};
  14. /******/
  15. /******/ // The require function
  16. /******/ function __webpack_require__(moduleId) {
  17. /******/
  18. /******/ // Check if module is in cache
  19. /******/ if(installedModules[moduleId]) {
  20. /******/ return installedModules[moduleId].exports;
  21. /******/ }
  22. /******/ // Create a new module (and put it into the cache)
  23. /******/ var module = installedModules[moduleId] = {
  24. /******/ i: moduleId,
  25. /******/ l: false,
  26. /******/ exports: {}
  27. /******/ };
  28. /******/
  29. /******/ // Execute the module function
  30. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  31. /******/
  32. /******/ // Flag the module as loaded
  33. /******/ module.l = true;
  34. /******/
  35. /******/ // Return the exports of the module
  36. /******/ return module.exports;
  37. /******/ }
  38. /******/
  39. /******/
  40. /******/ // expose the modules object (__webpack_modules__)
  41. /******/ __webpack_require__.m = modules;
  42. /******/
  43. /******/ // expose the module cache
  44. /******/ __webpack_require__.c = installedModules;
  45. /******/
  46. /******/ // define getter function for harmony exports
  47. /******/ __webpack_require__.d = function(exports, name, getter) {
  48. /******/ if(!__webpack_require__.o(exports, name)) {
  49. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  50. /******/ }
  51. /******/ };
  52. /******/
  53. /******/ // define __esModule on exports
  54. /******/ __webpack_require__.r = function(exports) {
  55. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  56. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  57. /******/ }
  58. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  59. /******/ };
  60. /******/
  61. /******/ // create a fake namespace object
  62. /******/ // mode & 1: value is a module id, require it
  63. /******/ // mode & 2: merge all properties of value into the ns
  64. /******/ // mode & 4: return value when already ns object
  65. /******/ // mode & 8|1: behave like require
  66. /******/ __webpack_require__.t = function(value, mode) {
  67. /******/ if(mode & 1) value = __webpack_require__(value);
  68. /******/ if(mode & 8) return value;
  69. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  70. /******/ var ns = Object.create(null);
  71. /******/ __webpack_require__.r(ns);
  72. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  73. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  74. /******/ return ns;
  75. /******/ };
  76. /******/
  77. /******/ // getDefaultExport function for compatibility with non-harmony modules
  78. /******/ __webpack_require__.n = function(module) {
  79. /******/ var getter = module && module.__esModule ?
  80. /******/ function getDefault() { return module['default']; } :
  81. /******/ function getModuleExports() { return module; };
  82. /******/ __webpack_require__.d(getter, 'a', getter);
  83. /******/ return getter;
  84. /******/ };
  85. /******/
  86. /******/ // Object.prototype.hasOwnProperty.call
  87. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  88. /******/
  89. /******/ // __webpack_public_path__
  90. /******/ __webpack_require__.p = "";
  91. /******/
  92. /******/
  93. /******/ // Load entry module and return exports
  94. /******/ return __webpack_require__(__webpack_require__.s = 14);
  95. /******/ })
  96. /************************************************************************/
  97. /******/ ({
  98. /***/ "./foundation.core":
  99. /*!****************************************************************************************************************************************************************!*\
  100. !*** external {"root":["__FOUNDATION_EXTERNAL__","foundation.core"],"amd":"./foundation.core","commonjs":"./foundation.core","commonjs2":"./foundation.core"} ***!
  101. \****************************************************************************************************************************************************************/
  102. /*! no static exports found */
  103. /***/ (function(module, exports) {
  104. module.exports = __WEBPACK_EXTERNAL_MODULE__foundation_core__;
  105. /***/ }),
  106. /***/ "./foundation.util.keyboard":
  107. /*!****************************************************************************************************************************************************************************************************!*\
  108. !*** external {"root":["__FOUNDATION_EXTERNAL__","foundation.util.keyboard"],"amd":"./foundation.util.keyboard","commonjs":"./foundation.util.keyboard","commonjs2":"./foundation.util.keyboard"} ***!
  109. \****************************************************************************************************************************************************************************************************/
  110. /*! no static exports found */
  111. /***/ (function(module, exports) {
  112. module.exports = __WEBPACK_EXTERNAL_MODULE__foundation_util_keyboard__;
  113. /***/ }),
  114. /***/ "./foundation.util.mediaQuery":
  115. /*!************************************************************************************************************************************************************************************************************!*\
  116. !*** external {"root":["__FOUNDATION_EXTERNAL__","foundation.util.mediaQuery"],"amd":"./foundation.util.mediaQuery","commonjs":"./foundation.util.mediaQuery","commonjs2":"./foundation.util.mediaQuery"} ***!
  117. \************************************************************************************************************************************************************************************************************/
  118. /*! no static exports found */
  119. /***/ (function(module, exports) {
  120. module.exports = __WEBPACK_EXTERNAL_MODULE__foundation_util_mediaQuery__;
  121. /***/ }),
  122. /***/ "./foundation.util.motion":
  123. /*!********************************************************************************************************************************************************************************************!*\
  124. !*** external {"root":["__FOUNDATION_EXTERNAL__","foundation.util.motion"],"amd":"./foundation.util.motion","commonjs":"./foundation.util.motion","commonjs2":"./foundation.util.motion"} ***!
  125. \********************************************************************************************************************************************************************************************/
  126. /*! no static exports found */
  127. /***/ (function(module, exports) {
  128. module.exports = __WEBPACK_EXTERNAL_MODULE__foundation_util_motion__;
  129. /***/ }),
  130. /***/ "./foundation.util.touch":
  131. /*!****************************************************************************************************************************************************************************************!*\
  132. !*** external {"root":["__FOUNDATION_EXTERNAL__","foundation.util.touch"],"amd":"./foundation.util.touch","commonjs":"./foundation.util.touch","commonjs2":"./foundation.util.touch"} ***!
  133. \****************************************************************************************************************************************************************************************/
  134. /*! no static exports found */
  135. /***/ (function(module, exports) {
  136. module.exports = __WEBPACK_EXTERNAL_MODULE__foundation_util_touch__;
  137. /***/ }),
  138. /***/ "./js/entries/plugins/foundation.reveal.js":
  139. /*!*************************************************!*\
  140. !*** ./js/entries/plugins/foundation.reveal.js ***!
  141. \*************************************************/
  142. /*! exports provided: Foundation, Reveal */
  143. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  144. "use strict";
  145. __webpack_require__.r(__webpack_exports__);
  146. /* harmony import */ var _foundation_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./foundation.core */ "./foundation.core");
  147. /* harmony import */ var _foundation_core__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_foundation_core__WEBPACK_IMPORTED_MODULE_0__);
  148. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Foundation", function() { return _foundation_core__WEBPACK_IMPORTED_MODULE_0__["Foundation"]; });
  149. /* harmony import */ var _foundation_reveal__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../foundation.reveal */ "./js/foundation.reveal.js");
  150. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Reveal", function() { return _foundation_reveal__WEBPACK_IMPORTED_MODULE_1__["Reveal"]; });
  151. _foundation_core__WEBPACK_IMPORTED_MODULE_0__["Foundation"].plugin(_foundation_reveal__WEBPACK_IMPORTED_MODULE_1__["Reveal"], 'Reveal');
  152. /***/ }),
  153. /***/ "./js/foundation.reveal.js":
  154. /*!*********************************!*\
  155. !*** ./js/foundation.reveal.js ***!
  156. \*********************************/
  157. /*! exports provided: Reveal */
  158. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  159. "use strict";
  160. __webpack_require__.r(__webpack_exports__);
  161. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Reveal", function() { return Reveal; });
  162. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "jquery");
  163. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  164. /* harmony import */ var _foundation_core_plugin__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./foundation.core.plugin */ "./foundation.core");
  165. /* harmony import */ var _foundation_core_plugin__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_foundation_core_plugin__WEBPACK_IMPORTED_MODULE_1__);
  166. /* harmony import */ var _foundation_util_keyboard__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./foundation.util.keyboard */ "./foundation.util.keyboard");
  167. /* harmony import */ var _foundation_util_keyboard__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_foundation_util_keyboard__WEBPACK_IMPORTED_MODULE_2__);
  168. /* harmony import */ var _foundation_util_mediaQuery__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./foundation.util.mediaQuery */ "./foundation.util.mediaQuery");
  169. /* harmony import */ var _foundation_util_mediaQuery__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_foundation_util_mediaQuery__WEBPACK_IMPORTED_MODULE_3__);
  170. /* harmony import */ var _foundation_util_motion__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./foundation.util.motion */ "./foundation.util.motion");
  171. /* harmony import */ var _foundation_util_motion__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_foundation_util_motion__WEBPACK_IMPORTED_MODULE_4__);
  172. /* harmony import */ var _foundation_util_triggers__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./foundation.util.triggers */ "./js/foundation.util.triggers.js");
  173. /* harmony import */ var _foundation_util_touch__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./foundation.util.touch */ "./foundation.util.touch");
  174. /* harmony import */ var _foundation_util_touch__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_foundation_util_touch__WEBPACK_IMPORTED_MODULE_6__);
  175. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  176. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  177. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  178. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  179. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  180. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  181. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  182. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  183. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  184. /**
  185. * Reveal module.
  186. * @module foundation.reveal
  187. * @requires foundation.util.keyboard
  188. * @requires foundation.util.touch
  189. * @requires foundation.util.triggers
  190. * @requires foundation.util.mediaQuery
  191. * @requires foundation.util.motion if using animations
  192. */
  193. var Reveal =
  194. /*#__PURE__*/
  195. function (_Plugin) {
  196. _inherits(Reveal, _Plugin);
  197. function Reveal() {
  198. _classCallCheck(this, Reveal);
  199. return _possibleConstructorReturn(this, _getPrototypeOf(Reveal).apply(this, arguments));
  200. }
  201. _createClass(Reveal, [{
  202. key: "_setup",
  203. /**
  204. * Creates a new instance of Reveal.
  205. * @class
  206. * @name Reveal
  207. * @param {jQuery} element - jQuery object to use for the modal.
  208. * @param {Object} options - optional parameters.
  209. */
  210. value: function _setup(element, options) {
  211. this.$element = element;
  212. this.options = jquery__WEBPACK_IMPORTED_MODULE_0___default.a.extend({}, Reveal.defaults, this.$element.data(), options);
  213. this.className = 'Reveal'; // ie9 back compat
  214. this._init(); // Touch and Triggers init are idempotent, just need to make sure they are initialized
  215. _foundation_util_touch__WEBPACK_IMPORTED_MODULE_6__["Touch"].init(jquery__WEBPACK_IMPORTED_MODULE_0___default.a);
  216. _foundation_util_triggers__WEBPACK_IMPORTED_MODULE_5__["Triggers"].init(jquery__WEBPACK_IMPORTED_MODULE_0___default.a);
  217. _foundation_util_keyboard__WEBPACK_IMPORTED_MODULE_2__["Keyboard"].register('Reveal', {
  218. 'ESCAPE': 'close'
  219. });
  220. }
  221. /**
  222. * Initializes the modal by adding the overlay and close buttons, (if selected).
  223. * @private
  224. */
  225. }, {
  226. key: "_init",
  227. value: function _init() {
  228. var _this2 = this;
  229. _foundation_util_mediaQuery__WEBPACK_IMPORTED_MODULE_3__["MediaQuery"]._init();
  230. this.id = this.$element.attr('id');
  231. this.isActive = false;
  232. this.cached = {
  233. mq: _foundation_util_mediaQuery__WEBPACK_IMPORTED_MODULE_3__["MediaQuery"].current
  234. };
  235. this.$anchor = jquery__WEBPACK_IMPORTED_MODULE_0___default()("[data-open=\"".concat(this.id, "\"]")).length ? jquery__WEBPACK_IMPORTED_MODULE_0___default()("[data-open=\"".concat(this.id, "\"]")) : jquery__WEBPACK_IMPORTED_MODULE_0___default()("[data-toggle=\"".concat(this.id, "\"]"));
  236. this.$anchor.attr({
  237. 'aria-controls': this.id,
  238. 'aria-haspopup': true,
  239. 'tabindex': 0
  240. });
  241. if (this.options.fullScreen || this.$element.hasClass('full')) {
  242. this.options.fullScreen = true;
  243. this.options.overlay = false;
  244. }
  245. if (this.options.overlay && !this.$overlay) {
  246. this.$overlay = this._makeOverlay(this.id);
  247. }
  248. this.$element.attr({
  249. 'role': 'dialog',
  250. 'aria-hidden': true,
  251. 'data-yeti-box': this.id,
  252. 'data-resize': this.id
  253. });
  254. if (this.$overlay) {
  255. this.$element.detach().appendTo(this.$overlay);
  256. } else {
  257. this.$element.detach().appendTo(jquery__WEBPACK_IMPORTED_MODULE_0___default()(this.options.appendTo));
  258. this.$element.addClass('without-overlay');
  259. }
  260. this._events();
  261. if (this.options.deepLink && window.location.hash === "#".concat(this.id)) {
  262. this.onLoadListener = Object(_foundation_core_plugin__WEBPACK_IMPORTED_MODULE_1__["onLoad"])(jquery__WEBPACK_IMPORTED_MODULE_0___default()(window), function () {
  263. return _this2.open();
  264. });
  265. }
  266. }
  267. /**
  268. * Creates an overlay div to display behind the modal.
  269. * @private
  270. */
  271. }, {
  272. key: "_makeOverlay",
  273. value: function _makeOverlay() {
  274. var additionalOverlayClasses = '';
  275. if (this.options.additionalOverlayClasses) {
  276. additionalOverlayClasses = ' ' + this.options.additionalOverlayClasses;
  277. }
  278. return jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div></div>').addClass('reveal-overlay' + additionalOverlayClasses).appendTo(this.options.appendTo);
  279. }
  280. /**
  281. * Updates position of modal
  282. * TODO: Figure out if we actually need to cache these values or if it doesn't matter
  283. * @private
  284. */
  285. }, {
  286. key: "_updatePosition",
  287. value: function _updatePosition() {
  288. var width = this.$element.outerWidth();
  289. var outerWidth = jquery__WEBPACK_IMPORTED_MODULE_0___default()(window).width();
  290. var height = this.$element.outerHeight();
  291. var outerHeight = jquery__WEBPACK_IMPORTED_MODULE_0___default()(window).height();
  292. var left,
  293. top = null;
  294. if (this.options.hOffset === 'auto') {
  295. left = parseInt((outerWidth - width) / 2, 10);
  296. } else {
  297. left = parseInt(this.options.hOffset, 10);
  298. }
  299. if (this.options.vOffset === 'auto') {
  300. if (height > outerHeight) {
  301. top = parseInt(Math.min(100, outerHeight / 10), 10);
  302. } else {
  303. top = parseInt((outerHeight - height) / 4, 10);
  304. }
  305. } else if (this.options.vOffset !== null) {
  306. top = parseInt(this.options.vOffset, 10);
  307. }
  308. if (top !== null) {
  309. this.$element.css({
  310. top: top + 'px'
  311. });
  312. } // only worry about left if we don't have an overlay or we have a horizontal offset,
  313. // otherwise we're perfectly in the middle
  314. if (!this.$overlay || this.options.hOffset !== 'auto') {
  315. this.$element.css({
  316. left: left + 'px'
  317. });
  318. this.$element.css({
  319. margin: '0px'
  320. });
  321. }
  322. }
  323. /**
  324. * Adds event handlers for the modal.
  325. * @private
  326. */
  327. }, {
  328. key: "_events",
  329. value: function _events() {
  330. var _this3 = this;
  331. var _this = this;
  332. this.$element.on({
  333. 'open.zf.trigger': this.open.bind(this),
  334. 'close.zf.trigger': function closeZfTrigger(event, $element) {
  335. if (event.target === _this.$element[0] || jquery__WEBPACK_IMPORTED_MODULE_0___default()(event.target).parents('[data-closable]')[0] === $element) {
  336. // only close reveal when it's explicitly called
  337. return _this3.close.apply(_this3);
  338. }
  339. },
  340. 'toggle.zf.trigger': this.toggle.bind(this),
  341. 'resizeme.zf.trigger': function resizemeZfTrigger() {
  342. _this._updatePosition();
  343. }
  344. });
  345. if (this.options.closeOnClick && this.options.overlay) {
  346. this.$overlay.off('.zf.reveal').on('click.zf.dropdown tap.zf.dropdown', function (e) {
  347. if (e.target === _this.$element[0] || jquery__WEBPACK_IMPORTED_MODULE_0___default.a.contains(_this.$element[0], e.target) || !jquery__WEBPACK_IMPORTED_MODULE_0___default.a.contains(document, e.target)) {
  348. return;
  349. }
  350. _this.close();
  351. });
  352. }
  353. if (this.options.deepLink) {
  354. jquery__WEBPACK_IMPORTED_MODULE_0___default()(window).on("hashchange.zf.reveal:".concat(this.id), this._handleState.bind(this));
  355. }
  356. }
  357. /**
  358. * Handles modal methods on back/forward button clicks or any other event that triggers hashchange.
  359. * @private
  360. */
  361. }, {
  362. key: "_handleState",
  363. value: function _handleState(e) {
  364. if (window.location.hash === '#' + this.id && !this.isActive) {
  365. this.open();
  366. } else {
  367. this.close();
  368. }
  369. }
  370. /**
  371. * Disables the scroll when Reveal is shown to prevent the background from shifting
  372. * @param {number} scrollTop - Scroll to visually apply, window current scroll by default
  373. */
  374. }, {
  375. key: "_disableScroll",
  376. value: function _disableScroll(scrollTop) {
  377. scrollTop = scrollTop || jquery__WEBPACK_IMPORTED_MODULE_0___default()(window).scrollTop();
  378. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(document).height() > jquery__WEBPACK_IMPORTED_MODULE_0___default()(window).height()) {
  379. jquery__WEBPACK_IMPORTED_MODULE_0___default()("html").css("top", -scrollTop);
  380. }
  381. }
  382. /**
  383. * Reenables the scroll when Reveal closes
  384. * @param {number} scrollTop - Scroll to restore, html "top" property by default (as set by `_disableScroll`)
  385. */
  386. }, {
  387. key: "_enableScroll",
  388. value: function _enableScroll(scrollTop) {
  389. scrollTop = scrollTop || parseInt(jquery__WEBPACK_IMPORTED_MODULE_0___default()("html").css("top"));
  390. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(document).height() > jquery__WEBPACK_IMPORTED_MODULE_0___default()(window).height()) {
  391. jquery__WEBPACK_IMPORTED_MODULE_0___default()("html").css("top", "");
  392. jquery__WEBPACK_IMPORTED_MODULE_0___default()(window).scrollTop(-scrollTop);
  393. }
  394. }
  395. /**
  396. * Opens the modal controlled by `this.$anchor`, and closes all others by default.
  397. * @function
  398. * @fires Reveal#closeme
  399. * @fires Reveal#open
  400. */
  401. }, {
  402. key: "open",
  403. value: function open() {
  404. var _this4 = this;
  405. // either update or replace browser history
  406. var hash = "#".concat(this.id);
  407. if (this.options.deepLink && window.location.hash !== hash) {
  408. if (window.history.pushState) {
  409. if (this.options.updateHistory) {
  410. window.history.pushState({}, '', hash);
  411. } else {
  412. window.history.replaceState({}, '', hash);
  413. }
  414. } else {
  415. window.location.hash = hash;
  416. }
  417. } // Remember anchor that opened it to set focus back later, have general anchors as fallback
  418. this.$activeAnchor = jquery__WEBPACK_IMPORTED_MODULE_0___default()(document.activeElement).is(this.$anchor) ? jquery__WEBPACK_IMPORTED_MODULE_0___default()(document.activeElement) : this.$anchor;
  419. this.isActive = true; // Make elements invisible, but remove display: none so we can get size and positioning
  420. this.$element.css({
  421. 'visibility': 'hidden'
  422. }).show().scrollTop(0);
  423. if (this.options.overlay) {
  424. this.$overlay.css({
  425. 'visibility': 'hidden'
  426. }).show();
  427. }
  428. this._updatePosition();
  429. this.$element.hide().css({
  430. 'visibility': ''
  431. });
  432. if (this.$overlay) {
  433. this.$overlay.css({
  434. 'visibility': ''
  435. }).hide();
  436. if (this.$element.hasClass('fast')) {
  437. this.$overlay.addClass('fast');
  438. } else if (this.$element.hasClass('slow')) {
  439. this.$overlay.addClass('slow');
  440. }
  441. }
  442. if (!this.options.multipleOpened) {
  443. /**
  444. * Fires immediately before the modal opens.
  445. * Closes any other modals that are currently open
  446. * @event Reveal#closeme
  447. */
  448. this.$element.trigger('closeme.zf.reveal', this.id);
  449. }
  450. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()('.reveal:visible').length === 0) {
  451. this._disableScroll();
  452. }
  453. var _this = this; // Motion UI method of reveal
  454. if (this.options.animationIn) {
  455. var afterAnimation = function afterAnimation() {
  456. _this.$element.attr({
  457. 'aria-hidden': false,
  458. 'tabindex': -1
  459. }).focus();
  460. _this._addGlobalClasses();
  461. _foundation_util_keyboard__WEBPACK_IMPORTED_MODULE_2__["Keyboard"].trapFocus(_this.$element);
  462. };
  463. if (this.options.overlay) {
  464. _foundation_util_motion__WEBPACK_IMPORTED_MODULE_4__["Motion"].animateIn(this.$overlay, 'fade-in');
  465. }
  466. _foundation_util_motion__WEBPACK_IMPORTED_MODULE_4__["Motion"].animateIn(this.$element, this.options.animationIn, function () {
  467. if (_this4.$element) {
  468. // protect against object having been removed
  469. _this4.focusableElements = _foundation_util_keyboard__WEBPACK_IMPORTED_MODULE_2__["Keyboard"].findFocusable(_this4.$element);
  470. afterAnimation();
  471. }
  472. });
  473. } // jQuery method of reveal
  474. else {
  475. if (this.options.overlay) {
  476. this.$overlay.show(0);
  477. }
  478. this.$element.show(this.options.showDelay);
  479. } // handle accessibility
  480. this.$element.attr({
  481. 'aria-hidden': false,
  482. 'tabindex': -1
  483. }).focus();
  484. _foundation_util_keyboard__WEBPACK_IMPORTED_MODULE_2__["Keyboard"].trapFocus(this.$element);
  485. this._addGlobalClasses();
  486. this._addGlobalListeners();
  487. /**
  488. * Fires when the modal has successfully opened.
  489. * @event Reveal#open
  490. */
  491. this.$element.trigger('open.zf.reveal');
  492. }
  493. /**
  494. * Adds classes and listeners on document required by open modals.
  495. *
  496. * The following classes are added and updated:
  497. * - `.is-reveal-open` - Prevents the scroll on document
  498. * - `.zf-has-scroll` - Displays a disabled scrollbar on document if required like if the
  499. * scroll was not disabled. This prevent a "shift" of the page content due
  500. * the scrollbar disappearing when the modal opens.
  501. *
  502. * @private
  503. */
  504. }, {
  505. key: "_addGlobalClasses",
  506. value: function _addGlobalClasses() {
  507. var updateScrollbarClass = function updateScrollbarClass() {
  508. jquery__WEBPACK_IMPORTED_MODULE_0___default()('html').toggleClass('zf-has-scroll', !!(jquery__WEBPACK_IMPORTED_MODULE_0___default()(document).height() > jquery__WEBPACK_IMPORTED_MODULE_0___default()(window).height()));
  509. };
  510. this.$element.on('resizeme.zf.trigger.revealScrollbarListener', function () {
  511. return updateScrollbarClass();
  512. });
  513. updateScrollbarClass();
  514. jquery__WEBPACK_IMPORTED_MODULE_0___default()('html').addClass('is-reveal-open');
  515. }
  516. /**
  517. * Removes classes and listeners on document that were required by open modals.
  518. * @private
  519. */
  520. }, {
  521. key: "_removeGlobalClasses",
  522. value: function _removeGlobalClasses() {
  523. this.$element.off('resizeme.zf.trigger.revealScrollbarListener');
  524. jquery__WEBPACK_IMPORTED_MODULE_0___default()('html').removeClass('is-reveal-open');
  525. jquery__WEBPACK_IMPORTED_MODULE_0___default()('html').removeClass('zf-has-scroll');
  526. }
  527. /**
  528. * Adds extra event handlers for the body and window if necessary.
  529. * @private
  530. */
  531. }, {
  532. key: "_addGlobalListeners",
  533. value: function _addGlobalListeners() {
  534. var _this = this;
  535. if (!this.$element) {
  536. return;
  537. } // If we're in the middle of cleanup, don't freak out
  538. this.focusableElements = _foundation_util_keyboard__WEBPACK_IMPORTED_MODULE_2__["Keyboard"].findFocusable(this.$element);
  539. if (!this.options.overlay && this.options.closeOnClick && !this.options.fullScreen) {
  540. jquery__WEBPACK_IMPORTED_MODULE_0___default()('body').on('click.zf.dropdown tap.zf.dropdown', function (e) {
  541. if (e.target === _this.$element[0] || jquery__WEBPACK_IMPORTED_MODULE_0___default.a.contains(_this.$element[0], e.target) || !jquery__WEBPACK_IMPORTED_MODULE_0___default.a.contains(document, e.target)) {
  542. return;
  543. }
  544. _this.close();
  545. });
  546. }
  547. if (this.options.closeOnEsc) {
  548. jquery__WEBPACK_IMPORTED_MODULE_0___default()(window).on('keydown.zf.reveal', function (e) {
  549. _foundation_util_keyboard__WEBPACK_IMPORTED_MODULE_2__["Keyboard"].handleKey(e, 'Reveal', {
  550. close: function close() {
  551. if (_this.options.closeOnEsc) {
  552. _this.close();
  553. }
  554. }
  555. });
  556. });
  557. }
  558. }
  559. /**
  560. * Closes the modal.
  561. * @function
  562. * @fires Reveal#closed
  563. */
  564. }, {
  565. key: "close",
  566. value: function close() {
  567. if (!this.isActive || !this.$element.is(':visible')) {
  568. return false;
  569. }
  570. var _this = this; // Motion UI method of hiding
  571. if (this.options.animationOut) {
  572. if (this.options.overlay) {
  573. _foundation_util_motion__WEBPACK_IMPORTED_MODULE_4__["Motion"].animateOut(this.$overlay, 'fade-out');
  574. }
  575. _foundation_util_motion__WEBPACK_IMPORTED_MODULE_4__["Motion"].animateOut(this.$element, this.options.animationOut, finishUp);
  576. } // jQuery method of hiding
  577. else {
  578. this.$element.hide(this.options.hideDelay);
  579. if (this.options.overlay) {
  580. this.$overlay.hide(0, finishUp);
  581. } else {
  582. finishUp();
  583. }
  584. } // Conditionals to remove extra event listeners added on open
  585. if (this.options.closeOnEsc) {
  586. jquery__WEBPACK_IMPORTED_MODULE_0___default()(window).off('keydown.zf.reveal');
  587. }
  588. if (!this.options.overlay && this.options.closeOnClick) {
  589. jquery__WEBPACK_IMPORTED_MODULE_0___default()('body').off('click.zf.dropdown tap.zf.dropdown');
  590. }
  591. this.$element.off('keydown.zf.reveal');
  592. function finishUp() {
  593. // Get the current top before the modal is closed and restore the scroll after.
  594. // TODO: use component properties instead of HTML properties
  595. // See https://github.com/foundation/foundation-sites/pull/10786
  596. var scrollTop = parseInt(jquery__WEBPACK_IMPORTED_MODULE_0___default()("html").css("top"));
  597. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()('.reveal:visible').length === 0) {
  598. _this._removeGlobalClasses(); // also remove .is-reveal-open from the html element when there is no opened reveal
  599. }
  600. _foundation_util_keyboard__WEBPACK_IMPORTED_MODULE_2__["Keyboard"].releaseFocus(_this.$element);
  601. _this.$element.attr('aria-hidden', true);
  602. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()('.reveal:visible').length === 0) {
  603. _this._enableScroll(scrollTop);
  604. }
  605. /**
  606. * Fires when the modal is done closing.
  607. * @event Reveal#closed
  608. */
  609. _this.$element.trigger('closed.zf.reveal');
  610. }
  611. /**
  612. * Resets the modal content
  613. * This prevents a running video to keep going in the background
  614. */
  615. if (this.options.resetOnClose) {
  616. this.$element.html(this.$element.html());
  617. }
  618. this.isActive = false; // If deepLink and we did not switched to an other modal...
  619. if (_this.options.deepLink && window.location.hash === "#".concat(this.id)) {
  620. // Remove the history hash
  621. if (window.history.replaceState) {
  622. var urlWithoutHash = window.location.pathname + window.location.search;
  623. if (this.options.updateHistory) {
  624. window.history.pushState({}, '', urlWithoutHash); // remove the hash
  625. } else {
  626. window.history.replaceState('', document.title, urlWithoutHash);
  627. }
  628. } else {
  629. window.location.hash = '';
  630. }
  631. }
  632. this.$activeAnchor.focus();
  633. }
  634. /**
  635. * Toggles the open/closed state of a modal.
  636. * @function
  637. */
  638. }, {
  639. key: "toggle",
  640. value: function toggle() {
  641. if (this.isActive) {
  642. this.close();
  643. } else {
  644. this.open();
  645. }
  646. }
  647. }, {
  648. key: "_destroy",
  649. /**
  650. * Destroys an instance of a modal.
  651. * @function
  652. */
  653. value: function _destroy() {
  654. if (this.options.overlay) {
  655. this.$element.appendTo(jquery__WEBPACK_IMPORTED_MODULE_0___default()(this.options.appendTo)); // move $element outside of $overlay to prevent error unregisterPlugin()
  656. this.$overlay.hide().off().remove();
  657. }
  658. this.$element.hide().off();
  659. this.$anchor.off('.zf');
  660. jquery__WEBPACK_IMPORTED_MODULE_0___default()(window).off(".zf.reveal:".concat(this.id));
  661. if (this.onLoadListener) jquery__WEBPACK_IMPORTED_MODULE_0___default()(window).off(this.onLoadListener);
  662. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()('.reveal:visible').length === 0) {
  663. this._removeGlobalClasses(); // also remove .is-reveal-open from the html element when there is no opened reveal
  664. }
  665. }
  666. }]);
  667. return Reveal;
  668. }(_foundation_core_plugin__WEBPACK_IMPORTED_MODULE_1__["Plugin"]);
  669. Reveal.defaults = {
  670. /**
  671. * Motion-UI class to use for animated elements. If none used, defaults to simple show/hide.
  672. * @option
  673. * @type {string}
  674. * @default ''
  675. */
  676. animationIn: '',
  677. /**
  678. * Motion-UI class to use for animated elements. If none used, defaults to simple show/hide.
  679. * @option
  680. * @type {string}
  681. * @default ''
  682. */
  683. animationOut: '',
  684. /**
  685. * Time, in ms, to delay the opening of a modal after a click if no animation used.
  686. * @option
  687. * @type {number}
  688. * @default 0
  689. */
  690. showDelay: 0,
  691. /**
  692. * Time, in ms, to delay the closing of a modal after a click if no animation used.
  693. * @option
  694. * @type {number}
  695. * @default 0
  696. */
  697. hideDelay: 0,
  698. /**
  699. * Allows a click on the body/overlay to close the modal.
  700. * @option
  701. * @type {boolean}
  702. * @default true
  703. */
  704. closeOnClick: true,
  705. /**
  706. * Allows the modal to close if the user presses the `ESCAPE` key.
  707. * @option
  708. * @type {boolean}
  709. * @default true
  710. */
  711. closeOnEsc: true,
  712. /**
  713. * If true, allows multiple modals to be displayed at once.
  714. * @option
  715. * @type {boolean}
  716. * @default false
  717. */
  718. multipleOpened: false,
  719. /**
  720. * Distance, in pixels, the modal should push down from the top of the screen.
  721. * @option
  722. * @type {number|string}
  723. * @default auto
  724. */
  725. vOffset: 'auto',
  726. /**
  727. * Distance, in pixels, the modal should push in from the side of the screen.
  728. * @option
  729. * @type {number|string}
  730. * @default auto
  731. */
  732. hOffset: 'auto',
  733. /**
  734. * Allows the modal to be fullscreen, completely blocking out the rest of the view. JS checks for this as well.
  735. * @option
  736. * @type {boolean}
  737. * @default false
  738. */
  739. fullScreen: false,
  740. /**
  741. * Allows the modal to generate an overlay div, which will cover the view when modal opens.
  742. * @option
  743. * @type {boolean}
  744. * @default true
  745. */
  746. overlay: true,
  747. /**
  748. * Allows the modal to remove and reinject markup on close. Should be true if using video elements w/o using provider's api, otherwise, videos will continue to play in the background.
  749. * @option
  750. * @type {boolean}
  751. * @default false
  752. */
  753. resetOnClose: false,
  754. /**
  755. * Link the location hash to the modal.
  756. * Set the location hash when the modal is opened/closed, and open/close the modal when the location changes.
  757. * @option
  758. * @type {boolean}
  759. * @default false
  760. */
  761. deepLink: false,
  762. /**
  763. * If `deepLink` is enabled, update the browser history with the open modal
  764. * @option
  765. * @default false
  766. */
  767. updateHistory: false,
  768. /**
  769. * Allows the modal to append to custom div.
  770. * @option
  771. * @type {string}
  772. * @default "body"
  773. */
  774. appendTo: "body",
  775. /**
  776. * Allows adding additional class names to the reveal overlay.
  777. * @option
  778. * @type {string}
  779. * @default ''
  780. */
  781. additionalOverlayClasses: ''
  782. };
  783. /***/ }),
  784. /***/ "./js/foundation.util.triggers.js":
  785. /*!****************************************!*\
  786. !*** ./js/foundation.util.triggers.js ***!
  787. \****************************************/
  788. /*! exports provided: Triggers */
  789. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  790. "use strict";
  791. __webpack_require__.r(__webpack_exports__);
  792. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Triggers", function() { return Triggers; });
  793. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "jquery");
  794. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  795. /* harmony import */ var _foundation_core_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./foundation.core.utils */ "./foundation.core");
  796. /* harmony import */ var _foundation_core_utils__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_foundation_core_utils__WEBPACK_IMPORTED_MODULE_1__);
  797. /* harmony import */ var _foundation_util_motion__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./foundation.util.motion */ "./foundation.util.motion");
  798. /* harmony import */ var _foundation_util_motion__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_foundation_util_motion__WEBPACK_IMPORTED_MODULE_2__);
  799. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  800. var MutationObserver = function () {
  801. var prefixes = ['WebKit', 'Moz', 'O', 'Ms', ''];
  802. for (var i = 0; i < prefixes.length; i++) {
  803. if ("".concat(prefixes[i], "MutationObserver") in window) {
  804. return window["".concat(prefixes[i], "MutationObserver")];
  805. }
  806. }
  807. return false;
  808. }();
  809. var triggers = function triggers(el, type) {
  810. el.data(type).split(' ').forEach(function (id) {
  811. jquery__WEBPACK_IMPORTED_MODULE_0___default()("#".concat(id))[type === 'close' ? 'trigger' : 'triggerHandler']("".concat(type, ".zf.trigger"), [el]);
  812. });
  813. };
  814. var Triggers = {
  815. Listeners: {
  816. Basic: {},
  817. Global: {}
  818. },
  819. Initializers: {}
  820. };
  821. Triggers.Listeners.Basic = {
  822. openListener: function openListener() {
  823. triggers(jquery__WEBPACK_IMPORTED_MODULE_0___default()(this), 'open');
  824. },
  825. closeListener: function closeListener() {
  826. var id = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('close');
  827. if (id) {
  828. triggers(jquery__WEBPACK_IMPORTED_MODULE_0___default()(this), 'close');
  829. } else {
  830. jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).trigger('close.zf.trigger');
  831. }
  832. },
  833. toggleListener: function toggleListener() {
  834. var id = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('toggle');
  835. if (id) {
  836. triggers(jquery__WEBPACK_IMPORTED_MODULE_0___default()(this), 'toggle');
  837. } else {
  838. jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).trigger('toggle.zf.trigger');
  839. }
  840. },
  841. closeableListener: function closeableListener(e) {
  842. var animation = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('closable'); // Only close the first closable element. See https://git.io/zf-7833
  843. e.stopPropagation();
  844. if (animation !== '') {
  845. _foundation_util_motion__WEBPACK_IMPORTED_MODULE_2__["Motion"].animateOut(jquery__WEBPACK_IMPORTED_MODULE_0___default()(this), animation, function () {
  846. jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).trigger('closed.zf');
  847. });
  848. } else {
  849. jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).fadeOut().trigger('closed.zf');
  850. }
  851. },
  852. toggleFocusListener: function toggleFocusListener() {
  853. var id = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('toggle-focus');
  854. jquery__WEBPACK_IMPORTED_MODULE_0___default()("#".concat(id)).triggerHandler('toggle.zf.trigger', [jquery__WEBPACK_IMPORTED_MODULE_0___default()(this)]);
  855. }
  856. }; // Elements with [data-open] will reveal a plugin that supports it when clicked.
  857. Triggers.Initializers.addOpenListener = function ($elem) {
  858. $elem.off('click.zf.trigger', Triggers.Listeners.Basic.openListener);
  859. $elem.on('click.zf.trigger', '[data-open]', Triggers.Listeners.Basic.openListener);
  860. }; // Elements with [data-close] will close a plugin that supports it when clicked.
  861. // If used without a value on [data-close], the event will bubble, allowing it to close a parent component.
  862. Triggers.Initializers.addCloseListener = function ($elem) {
  863. $elem.off('click.zf.trigger', Triggers.Listeners.Basic.closeListener);
  864. $elem.on('click.zf.trigger', '[data-close]', Triggers.Listeners.Basic.closeListener);
  865. }; // Elements with [data-toggle] will toggle a plugin that supports it when clicked.
  866. Triggers.Initializers.addToggleListener = function ($elem) {
  867. $elem.off('click.zf.trigger', Triggers.Listeners.Basic.toggleListener);
  868. $elem.on('click.zf.trigger', '[data-toggle]', Triggers.Listeners.Basic.toggleListener);
  869. }; // Elements with [data-closable] will respond to close.zf.trigger events.
  870. Triggers.Initializers.addCloseableListener = function ($elem) {
  871. $elem.off('close.zf.trigger', Triggers.Listeners.Basic.closeableListener);
  872. $elem.on('close.zf.trigger', '[data-closeable], [data-closable]', Triggers.Listeners.Basic.closeableListener);
  873. }; // Elements with [data-toggle-focus] will respond to coming in and out of focus
  874. Triggers.Initializers.addToggleFocusListener = function ($elem) {
  875. $elem.off('focus.zf.trigger blur.zf.trigger', Triggers.Listeners.Basic.toggleFocusListener);
  876. $elem.on('focus.zf.trigger blur.zf.trigger', '[data-toggle-focus]', Triggers.Listeners.Basic.toggleFocusListener);
  877. }; // More Global/complex listeners and triggers
  878. Triggers.Listeners.Global = {
  879. resizeListener: function resizeListener($nodes) {
  880. if (!MutationObserver) {
  881. //fallback for IE 9
  882. $nodes.each(function () {
  883. jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).triggerHandler('resizeme.zf.trigger');
  884. });
  885. } //trigger all listening elements and signal a resize event
  886. $nodes.attr('data-events', "resize");
  887. },
  888. scrollListener: function scrollListener($nodes) {
  889. if (!MutationObserver) {
  890. //fallback for IE 9
  891. $nodes.each(function () {
  892. jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).triggerHandler('scrollme.zf.trigger');
  893. });
  894. } //trigger all listening elements and signal a scroll event
  895. $nodes.attr('data-events', "scroll");
  896. },
  897. closeMeListener: function closeMeListener(e, pluginId) {
  898. var plugin = e.namespace.split('.')[0];
  899. var plugins = jquery__WEBPACK_IMPORTED_MODULE_0___default()("[data-".concat(plugin, "]")).not("[data-yeti-box=\"".concat(pluginId, "\"]"));
  900. plugins.each(function () {
  901. var _this = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this);
  902. _this.triggerHandler('close.zf.trigger', [_this]);
  903. });
  904. } // Global, parses whole document.
  905. };
  906. Triggers.Initializers.addClosemeListener = function (pluginName) {
  907. var yetiBoxes = jquery__WEBPACK_IMPORTED_MODULE_0___default()('[data-yeti-box]'),
  908. plugNames = ['dropdown', 'tooltip', 'reveal'];
  909. if (pluginName) {
  910. if (typeof pluginName === 'string') {
  911. plugNames.push(pluginName);
  912. } else if (_typeof(pluginName) === 'object' && typeof pluginName[0] === 'string') {
  913. plugNames = plugNames.concat(pluginName);
  914. } else {
  915. console.error('Plugin names must be strings');
  916. }
  917. }
  918. if (yetiBoxes.length) {
  919. var listeners = plugNames.map(function (name) {
  920. return "closeme.zf.".concat(name);
  921. }).join(' ');
  922. jquery__WEBPACK_IMPORTED_MODULE_0___default()(window).off(listeners).on(listeners, Triggers.Listeners.Global.closeMeListener);
  923. }
  924. };
  925. function debounceGlobalListener(debounce, trigger, listener) {
  926. var timer,
  927. args = Array.prototype.slice.call(arguments, 3);
  928. jquery__WEBPACK_IMPORTED_MODULE_0___default()(window).off(trigger).on(trigger, function (e) {
  929. if (timer) {
  930. clearTimeout(timer);
  931. }
  932. timer = setTimeout(function () {
  933. listener.apply(null, args);
  934. }, debounce || 10); //default time to emit scroll event
  935. });
  936. }
  937. Triggers.Initializers.addResizeListener = function (debounce) {
  938. var $nodes = jquery__WEBPACK_IMPORTED_MODULE_0___default()('[data-resize]');
  939. if ($nodes.length) {
  940. debounceGlobalListener(debounce, 'resize.zf.trigger', Triggers.Listeners.Global.resizeListener, $nodes);
  941. }
  942. };
  943. Triggers.Initializers.addScrollListener = function (debounce) {
  944. var $nodes = jquery__WEBPACK_IMPORTED_MODULE_0___default()('[data-scroll]');
  945. if ($nodes.length) {
  946. debounceGlobalListener(debounce, 'scroll.zf.trigger', Triggers.Listeners.Global.scrollListener, $nodes);
  947. }
  948. };
  949. Triggers.Initializers.addMutationEventsListener = function ($elem) {
  950. if (!MutationObserver) {
  951. return false;
  952. }
  953. var $nodes = $elem.find('[data-resize], [data-scroll], [data-mutate]'); //element callback
  954. var listeningElementsMutation = function listeningElementsMutation(mutationRecordsList) {
  955. var $target = jquery__WEBPACK_IMPORTED_MODULE_0___default()(mutationRecordsList[0].target); //trigger the event handler for the element depending on type
  956. switch (mutationRecordsList[0].type) {
  957. case "attributes":
  958. if ($target.attr("data-events") === "scroll" && mutationRecordsList[0].attributeName === "data-events") {
  959. $target.triggerHandler('scrollme.zf.trigger', [$target, window.pageYOffset]);
  960. }
  961. if ($target.attr("data-events") === "resize" && mutationRecordsList[0].attributeName === "data-events") {
  962. $target.triggerHandler('resizeme.zf.trigger', [$target]);
  963. }
  964. if (mutationRecordsList[0].attributeName === "style") {
  965. $target.closest("[data-mutate]").attr("data-events", "mutate");
  966. $target.closest("[data-mutate]").triggerHandler('mutateme.zf.trigger', [$target.closest("[data-mutate]")]);
  967. }
  968. break;
  969. case "childList":
  970. $target.closest("[data-mutate]").attr("data-events", "mutate");
  971. $target.closest("[data-mutate]").triggerHandler('mutateme.zf.trigger', [$target.closest("[data-mutate]")]);
  972. break;
  973. default:
  974. return false;
  975. //nothing
  976. }
  977. };
  978. if ($nodes.length) {
  979. //for each element that needs to listen for resizing, scrolling, or mutation add a single observer
  980. for (var i = 0; i <= $nodes.length - 1; i++) {
  981. var elementObserver = new MutationObserver(listeningElementsMutation);
  982. elementObserver.observe($nodes[i], {
  983. attributes: true,
  984. childList: true,
  985. characterData: false,
  986. subtree: true,
  987. attributeFilter: ["data-events", "style"]
  988. });
  989. }
  990. }
  991. };
  992. Triggers.Initializers.addSimpleListeners = function () {
  993. var $document = jquery__WEBPACK_IMPORTED_MODULE_0___default()(document);
  994. Triggers.Initializers.addOpenListener($document);
  995. Triggers.Initializers.addCloseListener($document);
  996. Triggers.Initializers.addToggleListener($document);
  997. Triggers.Initializers.addCloseableListener($document);
  998. Triggers.Initializers.addToggleFocusListener($document);
  999. };
  1000. Triggers.Initializers.addGlobalListeners = function () {
  1001. var $document = jquery__WEBPACK_IMPORTED_MODULE_0___default()(document);
  1002. Triggers.Initializers.addMutationEventsListener($document);
  1003. Triggers.Initializers.addResizeListener();
  1004. Triggers.Initializers.addScrollListener();
  1005. Triggers.Initializers.addClosemeListener();
  1006. };
  1007. Triggers.init = function ($, Foundation) {
  1008. Object(_foundation_core_utils__WEBPACK_IMPORTED_MODULE_1__["onLoad"])($(window), function () {
  1009. if ($.triggersInitialized !== true) {
  1010. Triggers.Initializers.addSimpleListeners();
  1011. Triggers.Initializers.addGlobalListeners();
  1012. $.triggersInitialized = true;
  1013. }
  1014. });
  1015. if (Foundation) {
  1016. Foundation.Triggers = Triggers; // Legacy included to be backwards compatible for now.
  1017. Foundation.IHearYou = Triggers.Initializers.addGlobalListeners;
  1018. }
  1019. };
  1020. /***/ }),
  1021. /***/ 14:
  1022. /*!*******************************************************!*\
  1023. !*** multi ./js/entries/plugins/foundation.reveal.js ***!
  1024. \*******************************************************/
  1025. /*! no static exports found */
  1026. /***/ (function(module, exports, __webpack_require__) {
  1027. module.exports = __webpack_require__(/*! /Users/joeworkman/Development/foundation-sites/js/entries/plugins/foundation.reveal.js */"./js/entries/plugins/foundation.reveal.js");
  1028. /***/ }),
  1029. /***/ "jquery":
  1030. /*!********************************************************************************************!*\
  1031. !*** external {"root":["jQuery"],"amd":"jquery","commonjs":"jquery","commonjs2":"jquery"} ***!
  1032. \********************************************************************************************/
  1033. /*! no static exports found */
  1034. /***/ (function(module, exports) {
  1035. module.exports = __WEBPACK_EXTERNAL_MODULE_jquery__;
  1036. /***/ })
  1037. /******/ });
  1038. });
  1039. //# sourceMappingURL=foundation.reveal.js.map