biofriction-wp-theme/node_modules/foundation-sites/dist/js/plugins/foundation.core.js

1072 lines
40 KiB
JavaScript

(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory(require("jquery"));
else if(typeof define === 'function' && define.amd)
define(["jquery"], factory);
else if(typeof exports === 'object')
exports["foundation.core"] = factory(require("jquery"));
else
root["__FOUNDATION_EXTERNAL__"] = root["__FOUNDATION_EXTERNAL__"] || {}, root["__FOUNDATION_EXTERNAL__"]["foundation.core"] = factory(root["jQuery"]);
})(window, function(__WEBPACK_EXTERNAL_MODULE_jquery__) {
return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 0);
/******/ })
/************************************************************************/
/******/ ({
/***/ "./js/entries/plugins/foundation.core.js":
/*!***********************************************!*\
!*** ./js/entries/plugins/foundation.core.js ***!
\***********************************************/
/*! exports provided: Foundation, Plugin, rtl, GetYoDigits, RegExpEscape, transitionend, onLoad, ignoreMousedisappear */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "jquery");
/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _foundation_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../foundation.core */ "./js/foundation.core.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Foundation", function() { return _foundation_core__WEBPACK_IMPORTED_MODULE_1__["Foundation"]; });
/* harmony import */ var _foundation_core_plugin__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../foundation.core.plugin */ "./js/foundation.core.plugin.js");
/* harmony import */ var _foundation_core_utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../foundation.core.utils */ "./js/foundation.core.utils.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Plugin", function() { return _foundation_core_plugin__WEBPACK_IMPORTED_MODULE_2__["Plugin"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "rtl", function() { return _foundation_core_utils__WEBPACK_IMPORTED_MODULE_3__["rtl"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "GetYoDigits", function() { return _foundation_core_utils__WEBPACK_IMPORTED_MODULE_3__["GetYoDigits"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "RegExpEscape", function() { return _foundation_core_utils__WEBPACK_IMPORTED_MODULE_3__["RegExpEscape"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "transitionend", function() { return _foundation_core_utils__WEBPACK_IMPORTED_MODULE_3__["transitionend"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "onLoad", function() { return _foundation_core_utils__WEBPACK_IMPORTED_MODULE_3__["onLoad"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ignoreMousedisappear", function() { return _foundation_core_utils__WEBPACK_IMPORTED_MODULE_3__["ignoreMousedisappear"]; });
// --- Foundation Core API ---
// Initialize Foundation and add some utilities to its public API for backward compatibility.
// Please note that every utility do not have to be added to the core API.
_foundation_core__WEBPACK_IMPORTED_MODULE_1__["Foundation"].addToJquery(jquery__WEBPACK_IMPORTED_MODULE_0___default.a); // Every plugin depends on plugin now, we can include that on the core for the
// script inclusion path.
_foundation_core__WEBPACK_IMPORTED_MODULE_1__["Foundation"].Plugin = _foundation_core_plugin__WEBPACK_IMPORTED_MODULE_2__["Plugin"]; // These are now separated out, but historically were a part of this module,
// and since this is here for backwards compatibility we include them in
// this entry.
_foundation_core__WEBPACK_IMPORTED_MODULE_1__["Foundation"].rtl = _foundation_core_utils__WEBPACK_IMPORTED_MODULE_3__["rtl"];
_foundation_core__WEBPACK_IMPORTED_MODULE_1__["Foundation"].GetYoDigits = _foundation_core_utils__WEBPACK_IMPORTED_MODULE_3__["GetYoDigits"];
_foundation_core__WEBPACK_IMPORTED_MODULE_1__["Foundation"].transitionend = _foundation_core_utils__WEBPACK_IMPORTED_MODULE_3__["transitionend"];
_foundation_core__WEBPACK_IMPORTED_MODULE_1__["Foundation"].RegExpEscape = _foundation_core_utils__WEBPACK_IMPORTED_MODULE_3__["RegExpEscape"];
_foundation_core__WEBPACK_IMPORTED_MODULE_1__["Foundation"].onLoad = _foundation_core_utils__WEBPACK_IMPORTED_MODULE_3__["onLoad"];
window.Foundation = _foundation_core__WEBPACK_IMPORTED_MODULE_1__["Foundation"]; // --- Foundation Core exports ---
// Export "Plugin" and all core utilities, since the `foundation.core` entry plays the role of
// all core source files.
/***/ }),
/***/ "./js/foundation.core.js":
/*!*******************************!*\
!*** ./js/foundation.core.js ***!
\*******************************/
/*! exports provided: Foundation */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Foundation", function() { return Foundation; });
/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "jquery");
/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _foundation_core_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./foundation.core.utils */ "./js/foundation.core.utils.js");
/* harmony import */ var _foundation_util_mediaQuery__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./foundation.util.mediaQuery */ "./js/foundation.util.mediaQuery.js");
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); }
var FOUNDATION_VERSION = '6.5.1'; // Global Foundation object
// This is attached to the window, or used as a module for AMD/Browserify
var Foundation = {
version: FOUNDATION_VERSION,
/**
* Stores initialized plugins.
*/
_plugins: {},
/**
* Stores generated unique ids for plugin instances
*/
_uuids: [],
/**
* Defines a Foundation plugin, adding it to the `Foundation` namespace and the list of plugins to initialize when reflowing.
* @param {Object} plugin - The constructor of the plugin.
*/
plugin: function plugin(_plugin, name) {
// Object key to use when adding to global Foundation object
// Examples: Foundation.Reveal, Foundation.OffCanvas
var className = name || functionName(_plugin); // Object key to use when storing the plugin, also used to create the identifying data attribute for the plugin
// Examples: data-reveal, data-off-canvas
var attrName = hyphenate(className); // Add to the Foundation object and the plugins list (for reflowing)
this._plugins[attrName] = this[className] = _plugin;
},
/**
* @function
* Populates the _uuids array with pointers to each individual plugin instance.
* Adds the `zfPlugin` data-attribute to programmatically created plugins to allow use of $(selector).foundation(method) calls.
* Also fires the initialization event for each plugin, consolidating repetitive code.
* @param {Object} plugin - an instance of a plugin, usually `this` in context.
* @param {String} name - the name of the plugin, passed as a camelCased string.
* @fires Plugin#init
*/
registerPlugin: function registerPlugin(plugin, name) {
var pluginName = name ? hyphenate(name) : functionName(plugin.constructor).toLowerCase();
plugin.uuid = Object(_foundation_core_utils__WEBPACK_IMPORTED_MODULE_1__["GetYoDigits"])(6, pluginName);
if (!plugin.$element.attr("data-".concat(pluginName))) {
plugin.$element.attr("data-".concat(pluginName), plugin.uuid);
}
if (!plugin.$element.data('zfPlugin')) {
plugin.$element.data('zfPlugin', plugin);
}
/**
* Fires when the plugin has initialized.
* @event Plugin#init
*/
plugin.$element.trigger("init.zf.".concat(pluginName));
this._uuids.push(plugin.uuid);
return;
},
/**
* @function
* Removes the plugins uuid from the _uuids array.
* Removes the zfPlugin data attribute, as well as the data-plugin-name attribute.
* Also fires the destroyed event for the plugin, consolidating repetitive code.
* @param {Object} plugin - an instance of a plugin, usually `this` in context.
* @fires Plugin#destroyed
*/
unregisterPlugin: function unregisterPlugin(plugin) {
var pluginName = hyphenate(functionName(plugin.$element.data('zfPlugin').constructor));
this._uuids.splice(this._uuids.indexOf(plugin.uuid), 1);
plugin.$element.removeAttr("data-".concat(pluginName)).removeData('zfPlugin')
/**
* Fires when the plugin has been destroyed.
* @event Plugin#destroyed
*/
.trigger("destroyed.zf.".concat(pluginName));
for (var prop in plugin) {
plugin[prop] = null; //clean up script to prep for garbage collection.
}
return;
},
/**
* @function
* Causes one or more active plugins to re-initialize, resetting event listeners, recalculating positions, etc.
* @param {String} plugins - optional string of an individual plugin key, attained by calling `$(element).data('pluginName')`, or string of a plugin class i.e. `'dropdown'`
* @default If no argument is passed, reflow all currently active plugins.
*/
reInit: function reInit(plugins) {
var isJQ = plugins instanceof jquery__WEBPACK_IMPORTED_MODULE_0___default.a;
try {
if (isJQ) {
plugins.each(function () {
jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('zfPlugin')._init();
});
} else {
var type = _typeof(plugins),
_this = this,
fns = {
'object': function object(plgs) {
plgs.forEach(function (p) {
p = hyphenate(p);
jquery__WEBPACK_IMPORTED_MODULE_0___default()('[data-' + p + ']').foundation('_init');
});
},
'string': function string() {
plugins = hyphenate(plugins);
jquery__WEBPACK_IMPORTED_MODULE_0___default()('[data-' + plugins + ']').foundation('_init');
},
'undefined': function undefined() {
this['object'](Object.keys(_this._plugins));
}
};
fns[type](plugins);
}
} catch (err) {
console.error(err);
} finally {
return plugins;
}
},
/**
* Initialize plugins on any elements within `elem` (and `elem` itself) that aren't already initialized.
* @param {Object} elem - jQuery object containing the element to check inside. Also checks the element itself, unless it's the `document` object.
* @param {String|Array} plugins - A list of plugins to initialize. Leave this out to initialize everything.
*/
reflow: function reflow(elem, plugins) {
// If plugins is undefined, just grab everything
if (typeof plugins === 'undefined') {
plugins = Object.keys(this._plugins);
} // If plugins is a string, convert it to an array with one item
else if (typeof plugins === 'string') {
plugins = [plugins];
}
var _this = this; // Iterate through each plugin
jquery__WEBPACK_IMPORTED_MODULE_0___default.a.each(plugins, function (i, name) {
// Get the current plugin
var plugin = _this._plugins[name]; // Localize the search to all elements inside elem, as well as elem itself, unless elem === document
var $elem = jquery__WEBPACK_IMPORTED_MODULE_0___default()(elem).find('[data-' + name + ']').addBack('[data-' + name + ']'); // For each plugin found, initialize it
$elem.each(function () {
var $el = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this),
opts = {}; // Don't double-dip on plugins
if ($el.data('zfPlugin')) {
console.warn("Tried to initialize " + name + " on an element that already has a Foundation plugin.");
return;
}
if ($el.attr('data-options')) {
var thing = $el.attr('data-options').split(';').forEach(function (e, i) {
var opt = e.split(':').map(function (el) {
return el.trim();
});
if (opt[0]) opts[opt[0]] = parseValue(opt[1]);
});
}
try {
$el.data('zfPlugin', new plugin(jquery__WEBPACK_IMPORTED_MODULE_0___default()(this), opts));
} catch (er) {
console.error(er);
} finally {
return;
}
});
});
},
getFnName: functionName,
addToJquery: function addToJquery($) {
// TODO: consider not making this a jQuery function
// TODO: need way to reflow vs. re-initialize
/**
* The Foundation jQuery method.
* @param {String|Array} method - An action to perform on the current jQuery object.
*/
var foundation = function foundation(method) {
var type = _typeof(method),
$noJS = $('.no-js');
if ($noJS.length) {
$noJS.removeClass('no-js');
}
if (type === 'undefined') {
//needs to initialize the Foundation object, or an individual plugin.
_foundation_util_mediaQuery__WEBPACK_IMPORTED_MODULE_2__["MediaQuery"]._init();
Foundation.reflow(this);
} else if (type === 'string') {
//an individual method to invoke on a plugin or group of plugins
var args = Array.prototype.slice.call(arguments, 1); //collect all the arguments, if necessary
var plugClass = this.data('zfPlugin'); //determine the class of plugin
if (typeof plugClass !== 'undefined' && typeof plugClass[method] !== 'undefined') {
//make sure both the class and method exist
if (this.length === 1) {
//if there's only one, call it directly.
plugClass[method].apply(plugClass, args);
} else {
this.each(function (i, el) {
//otherwise loop through the jQuery collection and invoke the method on each
plugClass[method].apply($(el).data('zfPlugin'), args);
});
}
} else {
//error for no class or no method
throw new ReferenceError("We're sorry, '" + method + "' is not an available method for " + (plugClass ? functionName(plugClass) : 'this element') + '.');
}
} else {
//error for invalid argument type
throw new TypeError("We're sorry, ".concat(type, " is not a valid parameter. You must use a string representing the method you wish to invoke."));
}
return this;
};
$.fn.foundation = foundation;
return $;
}
};
Foundation.util = {
/**
* Function for applying a debounce effect to a function call.
* @function
* @param {Function} func - Function to be called at end of timeout.
* @param {Number} delay - Time in ms to delay the call of `func`.
* @returns function
*/
throttle: function throttle(func, delay) {
var timer = null;
return function () {
var context = this,
args = arguments;
if (timer === null) {
timer = setTimeout(function () {
func.apply(context, args);
timer = null;
}, delay);
}
};
}
};
window.Foundation = Foundation; // Polyfill for requestAnimationFrame
(function () {
if (!Date.now || !window.Date.now) window.Date.now = Date.now = function () {
return new Date().getTime();
};
var vendors = ['webkit', 'moz'];
for (var i = 0; i < vendors.length && !window.requestAnimationFrame; ++i) {
var vp = vendors[i];
window.requestAnimationFrame = window[vp + 'RequestAnimationFrame'];
window.cancelAnimationFrame = window[vp + 'CancelAnimationFrame'] || window[vp + 'CancelRequestAnimationFrame'];
}
if (/iP(ad|hone|od).*OS 6/.test(window.navigator.userAgent) || !window.requestAnimationFrame || !window.cancelAnimationFrame) {
var lastTime = 0;
window.requestAnimationFrame = function (callback) {
var now = Date.now();
var nextTime = Math.max(lastTime + 16, now);
return setTimeout(function () {
callback(lastTime = nextTime);
}, nextTime - now);
};
window.cancelAnimationFrame = clearTimeout;
}
/**
* Polyfill for performance.now, required by rAF
*/
if (!window.performance || !window.performance.now) {
window.performance = {
start: Date.now(),
now: function now() {
return Date.now() - this.start;
}
};
}
})();
if (!Function.prototype.bind) {
Function.prototype.bind = function (oThis) {
if (typeof this !== 'function') {
// closest thing possible to the ECMAScript 5
// internal IsCallable function
throw new TypeError('Function.prototype.bind - what is trying to be bound is not callable');
}
var aArgs = Array.prototype.slice.call(arguments, 1),
fToBind = this,
fNOP = function fNOP() {},
fBound = function fBound() {
return fToBind.apply(this instanceof fNOP ? this : oThis, aArgs.concat(Array.prototype.slice.call(arguments)));
};
if (this.prototype) {
// native functions don't have a prototype
fNOP.prototype = this.prototype;
}
fBound.prototype = new fNOP();
return fBound;
};
} // Polyfill to get the name of a function in IE9
function functionName(fn) {
if (typeof Function.prototype.name === 'undefined') {
var funcNameRegex = /function\s([^(]{1,})\(/;
var results = funcNameRegex.exec(fn.toString());
return results && results.length > 1 ? results[1].trim() : "";
} else if (typeof fn.prototype === 'undefined') {
return fn.constructor.name;
} else {
return fn.prototype.constructor.name;
}
}
function parseValue(str) {
if ('true' === str) return true;else if ('false' === str) return false;else if (!isNaN(str * 1)) return parseFloat(str);
return str;
} // Convert PascalCase to kebab-case
// Thank you: http://stackoverflow.com/a/8955580
function hyphenate(str) {
return str.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
}
/***/ }),
/***/ "./js/foundation.core.plugin.js":
/*!**************************************!*\
!*** ./js/foundation.core.plugin.js ***!
\**************************************/
/*! exports provided: Plugin */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Plugin", function() { return Plugin; });
/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "jquery");
/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _foundation_core_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./foundation.core.utils */ "./js/foundation.core.utils.js");
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
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); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
// Abstract class for providing lifecycle hooks. Expect plugins to define AT LEAST
// {function} _setup (replaces previous constructor),
// {function} _destroy (replaces previous destroy)
var Plugin =
/*#__PURE__*/
function () {
function Plugin(element, options) {
_classCallCheck(this, Plugin);
this._setup(element, options);
var pluginName = getPluginName(this);
this.uuid = Object(_foundation_core_utils__WEBPACK_IMPORTED_MODULE_1__["GetYoDigits"])(6, pluginName);
if (!this.$element.attr("data-".concat(pluginName))) {
this.$element.attr("data-".concat(pluginName), this.uuid);
}
if (!this.$element.data('zfPlugin')) {
this.$element.data('zfPlugin', this);
}
/**
* Fires when the plugin has initialized.
* @event Plugin#init
*/
this.$element.trigger("init.zf.".concat(pluginName));
}
_createClass(Plugin, [{
key: "destroy",
value: function destroy() {
this._destroy();
var pluginName = getPluginName(this);
this.$element.removeAttr("data-".concat(pluginName)).removeData('zfPlugin')
/**
* Fires when the plugin has been destroyed.
* @event Plugin#destroyed
*/
.trigger("destroyed.zf.".concat(pluginName));
for (var prop in this) {
this[prop] = null; //clean up script to prep for garbage collection.
}
}
}]);
return Plugin;
}(); // Convert PascalCase to kebab-case
// Thank you: http://stackoverflow.com/a/8955580
function hyphenate(str) {
return str.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
}
function getPluginName(obj) {
if (typeof obj.constructor.name !== 'undefined') {
return hyphenate(obj.constructor.name);
} else {
return hyphenate(obj.className);
}
}
/***/ }),
/***/ "./js/foundation.core.utils.js":
/*!*************************************!*\
!*** ./js/foundation.core.utils.js ***!
\*************************************/
/*! exports provided: rtl, GetYoDigits, RegExpEscape, transitionend, onLoad, ignoreMousedisappear */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "rtl", function() { return rtl; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "GetYoDigits", function() { return GetYoDigits; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RegExpEscape", function() { return RegExpEscape; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "transitionend", function() { return transitionend; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "onLoad", function() { return onLoad; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ignoreMousedisappear", function() { return ignoreMousedisappear; });
/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "jquery");
/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
// Core Foundation Utilities, utilized in a number of places.
/**
* Returns a boolean for RTL support
*/
function rtl() {
return jquery__WEBPACK_IMPORTED_MODULE_0___default()('html').attr('dir') === 'rtl';
}
/**
* returns a random base-36 uid with namespacing
* @function
* @param {Number} length - number of random base-36 digits desired. Increase for more random strings.
* @param {String} namespace - name of plugin to be incorporated in uid, optional.
* @default {String} '' - if no plugin name is provided, nothing is appended to the uid.
* @returns {String} - unique id
*/
function GetYoDigits(length, namespace) {
length = length || 6;
return Math.round(Math.pow(36, length + 1) - Math.random() * Math.pow(36, length)).toString(36).slice(1) + (namespace ? "-".concat(namespace) : '');
}
/**
* Escape a string so it can be used as a regexp pattern
* @function
* @see https://stackoverflow.com/a/9310752/4317384
*
* @param {String} str - string to escape.
* @returns {String} - escaped string
*/
function RegExpEscape(str) {
return str.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
}
function transitionend($elem) {
var transitions = {
'transition': 'transitionend',
'WebkitTransition': 'webkitTransitionEnd',
'MozTransition': 'transitionend',
'OTransition': 'otransitionend'
};
var elem = document.createElement('div'),
end;
for (var t in transitions) {
if (typeof elem.style[t] !== 'undefined') {
end = transitions[t];
}
}
if (end) {
return end;
} else {
end = setTimeout(function () {
$elem.triggerHandler('transitionend', [$elem]);
}, 1);
return 'transitionend';
}
}
/**
* Return an event type to listen for window load.
*
* If `$elem` is passed, an event will be triggered on `$elem`. If window is already loaded, the event will still be triggered.
* If `handler` is passed, attach it to the event on `$elem`.
* Calling `onLoad` without handler allows you to get the event type that will be triggered before attaching the handler by yourself.
* @function
*
* @param {Object} [] $elem - jQuery element on which the event will be triggered if passed.
* @param {Function} [] handler - function to attach to the event.
* @returns {String} - event type that should or will be triggered.
*/
function onLoad($elem, handler) {
var didLoad = document.readyState === 'complete';
var eventType = (didLoad ? '_didLoad' : 'load') + '.zf.util.onLoad';
var cb = function cb() {
return $elem.triggerHandler(eventType);
};
if ($elem) {
if (handler) $elem.one(eventType, handler);
if (didLoad) setTimeout(cb);else jquery__WEBPACK_IMPORTED_MODULE_0___default()(window).one('load', cb);
}
return eventType;
}
/**
* Retuns an handler for the `mouseleave` that ignore disappeared mouses.
*
* If the mouse "disappeared" from the document (like when going on a browser UI element, See https://git.io/zf-11410),
* the event is ignored.
* - If the `ignoreLeaveWindow` is `true`, the event is ignored when the user actually left the window
* (like by switching to an other window with [Alt]+[Tab]).
* - If the `ignoreReappear` is `true`, the event will be ignored when the mouse will reappear later on the document
* outside of the element it left.
*
* @function
*
* @param {Function} [] handler - handler for the filtered `mouseleave` event to watch.
* @param {Object} [] options - object of options:
* - {Boolean} [false] ignoreLeaveWindow - also ignore when the user switched windows.
* - {Boolean} [false] ignoreReappear - also ignore when the mouse reappeared outside of the element it left.
* @returns {Function} - filtered handler to use to listen on the `mouseleave` event.
*/
function ignoreMousedisappear(handler) {
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
_ref$ignoreLeaveWindo = _ref.ignoreLeaveWindow,
ignoreLeaveWindow = _ref$ignoreLeaveWindo === void 0 ? false : _ref$ignoreLeaveWindo,
_ref$ignoreReappear = _ref.ignoreReappear,
ignoreReappear = _ref$ignoreReappear === void 0 ? false : _ref$ignoreReappear;
return function leaveEventHandler(eLeave) {
for (var _len = arguments.length, rest = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
rest[_key - 1] = arguments[_key];
}
var callback = handler.bind.apply(handler, [this, eLeave].concat(rest)); // The mouse left: call the given callback if the mouse entered elsewhere
if (eLeave.relatedTarget !== null) {
return callback();
} // Otherwise, check if the mouse actually left the window.
// In firefox if the user switched between windows, the window sill have the focus by the time
// the event is triggered. We have to debounce the event to test this case.
setTimeout(function leaveEventDebouncer() {
if (!ignoreLeaveWindow && document.hasFocus && !document.hasFocus()) {
return callback();
} // Otherwise, wait for the mouse to reeapear outside of the element,
if (!ignoreReappear) {
jquery__WEBPACK_IMPORTED_MODULE_0___default()(document).one('mouseenter', function reenterEventHandler(eReenter) {
if (!jquery__WEBPACK_IMPORTED_MODULE_0___default()(eLeave.currentTarget).has(eReenter.target).length) {
// Fill where the mouse finally entered.
eLeave.relatedTarget = eReenter.target;
callback();
}
});
}
}, 0);
};
}
/***/ }),
/***/ "./js/foundation.util.mediaQuery.js":
/*!******************************************!*\
!*** ./js/foundation.util.mediaQuery.js ***!
\******************************************/
/*! exports provided: MediaQuery */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MediaQuery", function() { return MediaQuery; });
/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "jquery");
/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
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); }
// Default set of media queries
var defaultQueries = {
'default': 'only screen',
landscape: 'only screen and (orientation: landscape)',
portrait: 'only screen and (orientation: portrait)',
retina: 'only screen and (-webkit-min-device-pixel-ratio: 2),' + 'only screen and (min--moz-device-pixel-ratio: 2),' + 'only screen and (-o-min-device-pixel-ratio: 2/1),' + 'only screen and (min-device-pixel-ratio: 2),' + 'only screen and (min-resolution: 192dpi),' + 'only screen and (min-resolution: 2dppx)'
}; // matchMedia() polyfill - Test a CSS media type/query in JS.
// Authors & copyright(c) 2012: Scott Jehl, Paul Irish, Nicholas Zakas, David Knight. MIT license
/* eslint-disable */
window.matchMedia || (window.matchMedia = function () {
"use strict"; // For browsers that support matchMedium api such as IE 9 and webkit
var styleMedia = window.styleMedia || window.media; // For those that don't support matchMedium
if (!styleMedia) {
var style = document.createElement('style'),
script = document.getElementsByTagName('script')[0],
info = null;
style.type = 'text/css';
style.id = 'matchmediajs-test';
if (!script) {
document.head.appendChild(style);
} else {
script.parentNode.insertBefore(style, script);
} // 'style.currentStyle' is used by IE <= 8 and 'window.getComputedStyle' for all other browsers
info = 'getComputedStyle' in window && window.getComputedStyle(style, null) || style.currentStyle;
styleMedia = {
matchMedium: function matchMedium(media) {
var text = '@media ' + media + '{ #matchmediajs-test { width: 1px; } }'; // 'style.styleSheet' is used by IE <= 8 and 'style.textContent' for all other browsers
if (style.styleSheet) {
style.styleSheet.cssText = text;
} else {
style.textContent = text;
} // Test if media query is true or false
return info.width === '1px';
}
};
}
return function (media) {
return {
matches: styleMedia.matchMedium(media || 'all'),
media: media || 'all'
};
};
}());
/* eslint-enable */
var MediaQuery = {
queries: [],
current: '',
/**
* Initializes the media query helper, by extracting the breakpoint list from the CSS and activating the breakpoint watcher.
* @function
* @private
*/
_init: function _init() {
var self = this;
var $meta = jquery__WEBPACK_IMPORTED_MODULE_0___default()('meta.foundation-mq');
if (!$meta.length) {
jquery__WEBPACK_IMPORTED_MODULE_0___default()('<meta class="foundation-mq">').appendTo(document.head);
}
var extractedStyles = jquery__WEBPACK_IMPORTED_MODULE_0___default()('.foundation-mq').css('font-family');
var namedQueries;
namedQueries = parseStyleToObject(extractedStyles);
for (var key in namedQueries) {
if (namedQueries.hasOwnProperty(key)) {
self.queries.push({
name: key,
value: "only screen and (min-width: ".concat(namedQueries[key], ")")
});
}
}
this.current = this._getCurrentSize();
this._watcher();
},
/**
* Checks if the screen is at least as wide as a breakpoint.
* @function
* @param {String} size - Name of the breakpoint to check.
* @returns {Boolean} `true` if the breakpoint matches, `false` if it's smaller.
*/
atLeast: function atLeast(size) {
var query = this.get(size);
if (query) {
return window.matchMedia(query).matches;
}
return false;
},
/**
* Checks if the screen matches to a breakpoint.
* @function
* @param {String} size - Name of the breakpoint to check, either 'small only' or 'small'. Omitting 'only' falls back to using atLeast() method.
* @returns {Boolean} `true` if the breakpoint matches, `false` if it does not.
*/
is: function is(size) {
size = size.trim().split(' ');
if (size.length > 1 && size[1] === 'only') {
if (size[0] === this._getCurrentSize()) return true;
} else {
return this.atLeast(size[0]);
}
return false;
},
/**
* Gets the media query of a breakpoint.
* @function
* @param {String} size - Name of the breakpoint to get.
* @returns {String|null} - The media query of the breakpoint, or `null` if the breakpoint doesn't exist.
*/
get: function get(size) {
for (var i in this.queries) {
if (this.queries.hasOwnProperty(i)) {
var query = this.queries[i];
if (size === query.name) return query.value;
}
}
return null;
},
/**
* Gets the current breakpoint name by testing every breakpoint and returning the last one to match (the biggest one).
* @function
* @private
* @returns {String} Name of the current breakpoint.
*/
_getCurrentSize: function _getCurrentSize() {
var matched;
for (var i = 0; i < this.queries.length; i++) {
var query = this.queries[i];
if (window.matchMedia(query.value).matches) {
matched = query;
}
}
if (_typeof(matched) === 'object') {
return matched.name;
} else {
return matched;
}
},
/**
* Activates the breakpoint watcher, which fires an event on the window whenever the breakpoint changes.
* @function
* @private
*/
_watcher: function _watcher() {
var _this = this;
jquery__WEBPACK_IMPORTED_MODULE_0___default()(window).off('resize.zf.mediaquery').on('resize.zf.mediaquery', function () {
var newSize = _this._getCurrentSize(),
currentSize = _this.current;
if (newSize !== currentSize) {
// Change the current media query
_this.current = newSize; // Broadcast the media query change on the window
jquery__WEBPACK_IMPORTED_MODULE_0___default()(window).trigger('changed.zf.mediaquery', [newSize, currentSize]);
}
});
}
}; // Thank you: https://github.com/sindresorhus/query-string
function parseStyleToObject(str) {
var styleObject = {};
if (typeof str !== 'string') {
return styleObject;
}
str = str.trim().slice(1, -1); // browsers re-quote string style values
if (!str) {
return styleObject;
}
styleObject = str.split('&').reduce(function (ret, param) {
var parts = param.replace(/\+/g, ' ').split('=');
var key = parts[0];
var val = parts[1];
key = decodeURIComponent(key); // missing `=` should be `null`:
// http://w3.org/TR/2012/WD-url-20120524/#collect-url-parameters
val = typeof val === 'undefined' ? null : decodeURIComponent(val);
if (!ret.hasOwnProperty(key)) {
ret[key] = val;
} else if (Array.isArray(ret[key])) {
ret[key].push(val);
} else {
ret[key] = [ret[key], val];
}
return ret;
}, {});
return styleObject;
}
/***/ }),
/***/ 0:
/*!*****************************************************!*\
!*** multi ./js/entries/plugins/foundation.core.js ***!
\*****************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(/*! /Users/ncoden/Documents/Documents/Projects/Programmation/Web/2016/Foundation/foundation-sites/js/entries/plugins/foundation.core.js */"./js/entries/plugins/foundation.core.js");
/***/ }),
/***/ "jquery":
/*!********************************************************************************************!*\
!*** external {"root":["jQuery"],"amd":"jquery","commonjs":"jquery","commonjs2":"jquery"} ***!
\********************************************************************************************/
/*! no static exports found */
/***/ (function(module, exports) {
module.exports = __WEBPACK_EXTERNAL_MODULE_jquery__;
/***/ })
/******/ });
});
//# sourceMappingURL=foundation.core.js.map