1 | (function webpackUniversalModuleDefinition(root, factory) {
|
2 | if(typeof exports === 'object' && typeof module === 'object')
|
3 | module.exports = factory(require("./foundation.core"), require("./foundation.util.imageLoader"), require("./foundation.util.mediaQuery"), require("jquery"));
|
4 | else if(typeof define === 'function' && define.amd)
|
5 | define(["./foundation.core", "./foundation.util.imageLoader", "./foundation.util.mediaQuery", "jquery"], factory);
|
6 | else if(typeof exports === 'object')
|
7 | exports["foundation.equalizer"] = factory(require("./foundation.core"), require("./foundation.util.imageLoader"), require("./foundation.util.mediaQuery"), require("jquery"));
|
8 | else
|
9 | root["__FOUNDATION_EXTERNAL__"] = root["__FOUNDATION_EXTERNAL__"] || {}, root["__FOUNDATION_EXTERNAL__"]["foundation.equalizer"] = factory(root["__FOUNDATION_EXTERNAL__"]["foundation.core"], root["__FOUNDATION_EXTERNAL__"]["foundation.util.imageLoader"], root["__FOUNDATION_EXTERNAL__"]["foundation.util.mediaQuery"], root["jQuery"]);
|
10 | })(window, function(__WEBPACK_EXTERNAL_MODULE__foundation_core__, __WEBPACK_EXTERNAL_MODULE__foundation_util_imageLoader__, __WEBPACK_EXTERNAL_MODULE__foundation_util_mediaQuery__, __WEBPACK_EXTERNAL_MODULE_jquery__) {
|
11 | return (function(modules) {
|
12 |
|
13 | var installedModules = {};
|
14 |
|
15 |
|
16 | function __webpack_require__(moduleId) {
|
17 |
|
18 |
|
19 | if(installedModules[moduleId]) {
|
20 | return installedModules[moduleId].exports;
|
21 | }
|
22 |
|
23 | var module = installedModules[moduleId] = {
|
24 | i: moduleId,
|
25 | l: false,
|
26 | exports: {}
|
27 | };
|
28 |
|
29 |
|
30 | modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
31 |
|
32 |
|
33 | module.l = true;
|
34 |
|
35 |
|
36 | return module.exports;
|
37 | }
|
38 |
|
39 |
|
40 |
|
41 | __webpack_require__.m = modules;
|
42 |
|
43 |
|
44 | __webpack_require__.c = installedModules;
|
45 |
|
46 |
|
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 |
|
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 |
|
62 |
|
63 |
|
64 |
|
65 |
|
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 |
|
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 |
|
87 | __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
88 |
|
89 |
|
90 | __webpack_require__.p = "";
|
91 |
|
92 |
|
93 |
|
94 | return __webpack_require__(__webpack_require__.s = 6);
|
95 | })
|
96 |
|
97 | ({
|
98 |
|
99 | "./foundation.core":
|
100 |
|
101 |
|
102 |
|
103 |
|
104 | (function(module, exports) {
|
105 |
|
106 | module.exports = __WEBPACK_EXTERNAL_MODULE__foundation_core__;
|
107 |
|
108 | }),
|
109 |
|
110 | "./foundation.util.imageLoader":
|
111 |
|
112 |
|
113 |
|
114 |
|
115 | (function(module, exports) {
|
116 |
|
117 | module.exports = __WEBPACK_EXTERNAL_MODULE__foundation_util_imageLoader__;
|
118 |
|
119 | }),
|
120 |
|
121 | "./foundation.util.mediaQuery":
|
122 |
|
123 |
|
124 |
|
125 |
|
126 | (function(module, exports) {
|
127 |
|
128 | module.exports = __WEBPACK_EXTERNAL_MODULE__foundation_util_mediaQuery__;
|
129 |
|
130 | }),
|
131 |
|
132 | "./js/entries/plugins/foundation.equalizer.js":
|
133 |
|
134 |
|
135 |
|
136 |
|
137 | (function(module, __webpack_exports__, __webpack_require__) {
|
138 |
|
139 | "use strict";
|
140 | __webpack_require__.r(__webpack_exports__);
|
141 | var _foundation_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( "./foundation.core");
|
142 | var _foundation_core__WEBPACK_IMPORTED_MODULE_0___default = __webpack_require__.n(_foundation_core__WEBPACK_IMPORTED_MODULE_0__);
|
143 | __webpack_require__.d(__webpack_exports__, "Foundation", function() { return _foundation_core__WEBPACK_IMPORTED_MODULE_0__["Foundation"]; });
|
144 |
|
145 | var _foundation_equalizer__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( "./js/foundation.equalizer.js");
|
146 | __webpack_require__.d(__webpack_exports__, "Equalizer", function() { return _foundation_equalizer__WEBPACK_IMPORTED_MODULE_1__["Equalizer"]; });
|
147 |
|
148 |
|
149 |
|
150 | _foundation_core__WEBPACK_IMPORTED_MODULE_0__["Foundation"].plugin(_foundation_equalizer__WEBPACK_IMPORTED_MODULE_1__["Equalizer"], 'Equalizer');
|
151 |
|
152 |
|
153 | }),
|
154 |
|
155 | "./js/foundation.equalizer.js":
|
156 |
|
157 |
|
158 |
|
159 |
|
160 | (function(module, __webpack_exports__, __webpack_require__) {
|
161 |
|
162 | "use strict";
|
163 | __webpack_require__.r(__webpack_exports__);
|
164 | __webpack_require__.d(__webpack_exports__, "Equalizer", function() { return Equalizer; });
|
165 | var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( "jquery");
|
166 | var jquery__WEBPACK_IMPORTED_MODULE_0___default = __webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
|
167 | var _foundation_util_mediaQuery__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( "./foundation.util.mediaQuery");
|
168 | var _foundation_util_mediaQuery__WEBPACK_IMPORTED_MODULE_1___default = __webpack_require__.n(_foundation_util_mediaQuery__WEBPACK_IMPORTED_MODULE_1__);
|
169 | var _foundation_util_imageLoader__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__( "./foundation.util.imageLoader");
|
170 | var _foundation_util_imageLoader__WEBPACK_IMPORTED_MODULE_2___default = __webpack_require__.n(_foundation_util_imageLoader__WEBPACK_IMPORTED_MODULE_2__);
|
171 | var _foundation_core_utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__( "./foundation.core");
|
172 | var _foundation_core_utils__WEBPACK_IMPORTED_MODULE_3___default = __webpack_require__.n(_foundation_core_utils__WEBPACK_IMPORTED_MODULE_3__);
|
173 |
|
174 |
|
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 |
|
177 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
178 |
|
179 | 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); } }
|
180 |
|
181 | function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
182 |
|
183 | function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
184 |
|
185 | function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
186 |
|
187 | function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
188 |
|
189 | 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); }
|
190 |
|
191 | function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
192 |
|
193 |
|
194 |
|
195 |
|
196 |
|
197 |
|
198 |
|
199 |
|
200 |
|
201 |
|
202 |
|
203 |
|
204 |
|
205 | var Equalizer =
|
206 |
|
207 | function (_Plugin) {
|
208 | _inherits(Equalizer, _Plugin);
|
209 |
|
210 | function Equalizer() {
|
211 | _classCallCheck(this, Equalizer);
|
212 |
|
213 | return _possibleConstructorReturn(this, _getPrototypeOf(Equalizer).apply(this, arguments));
|
214 | }
|
215 |
|
216 | _createClass(Equalizer, [{
|
217 | key: "_setup",
|
218 |
|
219 | |
220 |
|
221 |
|
222 |
|
223 |
|
224 |
|
225 |
|
226 |
|
227 | value: function _setup(element, options) {
|
228 | this.$element = element;
|
229 | this.options = jquery__WEBPACK_IMPORTED_MODULE_0___default.a.extend({}, Equalizer.defaults, this.$element.data(), options);
|
230 | this.className = 'Equalizer';
|
231 |
|
232 | this._init();
|
233 | }
|
234 | |
235 |
|
236 |
|
237 |
|
238 |
|
239 | }, {
|
240 | key: "_init",
|
241 | value: function _init() {
|
242 | var eqId = this.$element.attr('data-equalizer') || '';
|
243 | var $watched = this.$element.find("[data-equalizer-watch=\"".concat(eqId, "\"]"));
|
244 |
|
245 | _foundation_util_mediaQuery__WEBPACK_IMPORTED_MODULE_1__["MediaQuery"]._init();
|
246 |
|
247 | this.$watched = $watched.length ? $watched : this.$element.find('[data-equalizer-watch]');
|
248 | this.$element.attr('data-resize', eqId || Object(_foundation_core_utils__WEBPACK_IMPORTED_MODULE_3__["GetYoDigits"])(6, 'eq'));
|
249 | this.$element.attr('data-mutate', eqId || Object(_foundation_core_utils__WEBPACK_IMPORTED_MODULE_3__["GetYoDigits"])(6, 'eq'));
|
250 | this.hasNested = this.$element.find('[data-equalizer]').length > 0;
|
251 | this.isNested = this.$element.parentsUntil(document.body, '[data-equalizer]').length > 0;
|
252 | this.isOn = false;
|
253 | this._bindHandler = {
|
254 | onResizeMeBound: this._onResizeMe.bind(this),
|
255 | onPostEqualizedBound: this._onPostEqualized.bind(this)
|
256 | };
|
257 | var imgs = this.$element.find('img');
|
258 | var tooSmall;
|
259 |
|
260 | if (this.options.equalizeOn) {
|
261 | tooSmall = this._checkMQ();
|
262 | jquery__WEBPACK_IMPORTED_MODULE_0___default()(window).on('changed.zf.mediaquery', this._checkMQ.bind(this));
|
263 | } else {
|
264 | this._events();
|
265 | }
|
266 |
|
267 | if (typeof tooSmall !== 'undefined' && tooSmall === false || typeof tooSmall === 'undefined') {
|
268 | if (imgs.length) {
|
269 | Object(_foundation_util_imageLoader__WEBPACK_IMPORTED_MODULE_2__["onImagesLoaded"])(imgs, this._reflow.bind(this));
|
270 | } else {
|
271 | this._reflow();
|
272 | }
|
273 | }
|
274 | }
|
275 | |
276 |
|
277 |
|
278 |
|
279 |
|
280 | }, {
|
281 | key: "_pauseEvents",
|
282 | value: function _pauseEvents() {
|
283 | this.isOn = false;
|
284 | this.$element.off({
|
285 | '.zf.equalizer': this._bindHandler.onPostEqualizedBound,
|
286 | 'resizeme.zf.trigger': this._bindHandler.onResizeMeBound,
|
287 | 'mutateme.zf.trigger': this._bindHandler.onResizeMeBound
|
288 | });
|
289 | }
|
290 | |
291 |
|
292 |
|
293 |
|
294 |
|
295 | }, {
|
296 | key: "_onResizeMe",
|
297 | value: function _onResizeMe(e) {
|
298 | this._reflow();
|
299 | }
|
300 | |
301 |
|
302 |
|
303 |
|
304 |
|
305 | }, {
|
306 | key: "_onPostEqualized",
|
307 | value: function _onPostEqualized(e) {
|
308 | if (e.target !== this.$element[0]) {
|
309 | this._reflow();
|
310 | }
|
311 | }
|
312 | |
313 |
|
314 |
|
315 |
|
316 |
|
317 | }, {
|
318 | key: "_events",
|
319 | value: function _events() {
|
320 | var _this = this;
|
321 |
|
322 | this._pauseEvents();
|
323 |
|
324 | if (this.hasNested) {
|
325 | this.$element.on('postequalized.zf.equalizer', this._bindHandler.onPostEqualizedBound);
|
326 | } else {
|
327 | this.$element.on('resizeme.zf.trigger', this._bindHandler.onResizeMeBound);
|
328 | this.$element.on('mutateme.zf.trigger', this._bindHandler.onResizeMeBound);
|
329 | }
|
330 |
|
331 | this.isOn = true;
|
332 | }
|
333 | |
334 |
|
335 |
|
336 |
|
337 |
|
338 | }, {
|
339 | key: "_checkMQ",
|
340 | value: function _checkMQ() {
|
341 | var tooSmall = !_foundation_util_mediaQuery__WEBPACK_IMPORTED_MODULE_1__["MediaQuery"].is(this.options.equalizeOn);
|
342 |
|
343 | if (tooSmall) {
|
344 | if (this.isOn) {
|
345 | this._pauseEvents();
|
346 |
|
347 | this.$watched.css('height', 'auto');
|
348 | }
|
349 | } else {
|
350 | if (!this.isOn) {
|
351 | this._events();
|
352 | }
|
353 | }
|
354 |
|
355 | return tooSmall;
|
356 | }
|
357 | |
358 |
|
359 |
|
360 |
|
361 |
|
362 | }, {
|
363 | key: "_killswitch",
|
364 | value: function _killswitch() {
|
365 | return;
|
366 | }
|
367 | |
368 |
|
369 |
|
370 |
|
371 |
|
372 | }, {
|
373 | key: "_reflow",
|
374 | value: function _reflow() {
|
375 | if (!this.options.equalizeOnStack) {
|
376 | if (this._isStacked()) {
|
377 | this.$watched.css('height', 'auto');
|
378 | return false;
|
379 | }
|
380 | }
|
381 |
|
382 | if (this.options.equalizeByRow) {
|
383 | this.getHeightsByRow(this.applyHeightByRow.bind(this));
|
384 | } else {
|
385 | this.getHeights(this.applyHeight.bind(this));
|
386 | }
|
387 | }
|
388 | |
389 |
|
390 |
|
391 |
|
392 |
|
393 | }, {
|
394 | key: "_isStacked",
|
395 | value: function _isStacked() {
|
396 | if (!this.$watched[0] || !this.$watched[1]) {
|
397 | return true;
|
398 | }
|
399 |
|
400 | return this.$watched[0].getBoundingClientRect().top !== this.$watched[1].getBoundingClientRect().top;
|
401 | }
|
402 | |
403 |
|
404 |
|
405 |
|
406 |
|
407 |
|
408 | }, {
|
409 | key: "getHeights",
|
410 | value: function getHeights(cb) {
|
411 | var heights = [];
|
412 |
|
413 | for (var i = 0, len = this.$watched.length; i < len; i++) {
|
414 | this.$watched[i].style.height = 'auto';
|
415 | heights.push(this.$watched[i].offsetHeight);
|
416 | }
|
417 |
|
418 | cb(heights);
|
419 | }
|
420 | |
421 |
|
422 |
|
423 |
|
424 |
|
425 |
|
426 | }, {
|
427 | key: "getHeightsByRow",
|
428 | value: function getHeightsByRow(cb) {
|
429 | var lastElTopOffset = this.$watched.length ? this.$watched.first().offset().top : 0,
|
430 | groups = [],
|
431 | group = 0;
|
432 |
|
433 | groups[group] = [];
|
434 |
|
435 | for (var i = 0, len = this.$watched.length; i < len; i++) {
|
436 | this.$watched[i].style.height = 'auto';
|
437 |
|
438 | var elOffsetTop = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this.$watched[i]).offset().top;
|
439 |
|
440 | if (elOffsetTop != lastElTopOffset) {
|
441 | group++;
|
442 | groups[group] = [];
|
443 | lastElTopOffset = elOffsetTop;
|
444 | }
|
445 |
|
446 | groups[group].push([this.$watched[i], this.$watched[i].offsetHeight]);
|
447 | }
|
448 |
|
449 | for (var j = 0, ln = groups.length; j < ln; j++) {
|
450 | var heights = jquery__WEBPACK_IMPORTED_MODULE_0___default()(groups[j]).map(function () {
|
451 | return this[1];
|
452 | }).get();
|
453 | var max = Math.max.apply(null, heights);
|
454 | groups[j].push(max);
|
455 | }
|
456 |
|
457 | cb(groups);
|
458 | }
|
459 | |
460 |
|
461 |
|
462 |
|
463 |
|
464 |
|
465 |
|
466 | }, {
|
467 | key: "applyHeight",
|
468 | value: function applyHeight(heights) {
|
469 | var max = Math.max.apply(null, heights);
|
470 | |
471 |
|
472 |
|
473 |
|
474 |
|
475 | this.$element.trigger('preequalized.zf.equalizer');
|
476 | this.$watched.css('height', max);
|
477 | |
478 |
|
479 |
|
480 |
|
481 |
|
482 | this.$element.trigger('postequalized.zf.equalizer');
|
483 | }
|
484 | |
485 |
|
486 |
|
487 |
|
488 |
|
489 |
|
490 |
|
491 |
|
492 |
|
493 | }, {
|
494 | key: "applyHeightByRow",
|
495 | value: function applyHeightByRow(groups) {
|
496 | |
497 |
|
498 |
|
499 | this.$element.trigger('preequalized.zf.equalizer');
|
500 |
|
501 | for (var i = 0, len = groups.length; i < len; i++) {
|
502 | var groupsILength = groups[i].length,
|
503 | max = groups[i][groupsILength - 1];
|
504 |
|
505 | if (groupsILength <= 2) {
|
506 | jquery__WEBPACK_IMPORTED_MODULE_0___default()(groups[i][0][0]).css({
|
507 | 'height': 'auto'
|
508 | });
|
509 | continue;
|
510 | }
|
511 | |
512 |
|
513 |
|
514 |
|
515 |
|
516 |
|
517 | this.$element.trigger('preequalizedrow.zf.equalizer');
|
518 |
|
519 | for (var j = 0, lenJ = groupsILength - 1; j < lenJ; j++) {
|
520 | jquery__WEBPACK_IMPORTED_MODULE_0___default()(groups[i][j][0]).css({
|
521 | 'height': max
|
522 | });
|
523 | }
|
524 | |
525 |
|
526 |
|
527 |
|
528 |
|
529 |
|
530 | this.$element.trigger('postequalizedrow.zf.equalizer');
|
531 | }
|
532 | |
533 |
|
534 |
|
535 |
|
536 |
|
537 | this.$element.trigger('postequalized.zf.equalizer');
|
538 | }
|
539 | |
540 |
|
541 |
|
542 |
|
543 |
|
544 | }, {
|
545 | key: "_destroy",
|
546 | value: function _destroy() {
|
547 | this._pauseEvents();
|
548 |
|
549 | this.$watched.css('height', 'auto');
|
550 | }
|
551 | }]);
|
552 |
|
553 | return Equalizer;
|
554 | }(_foundation_core_utils__WEBPACK_IMPORTED_MODULE_3__["Plugin"]);
|
555 |
|
556 |
|
557 |
|
558 |
|
559 |
|
560 | Equalizer.defaults = {
|
561 | |
562 |
|
563 |
|
564 |
|
565 |
|
566 |
|
567 | equalizeOnStack: false,
|
568 |
|
569 | |
570 |
|
571 |
|
572 |
|
573 |
|
574 |
|
575 | equalizeByRow: false,
|
576 |
|
577 | |
578 |
|
579 |
|
580 |
|
581 |
|
582 |
|
583 | equalizeOn: ''
|
584 | };
|
585 |
|
586 |
|
587 | }),
|
588 |
|
589 | 6:
|
590 |
|
591 |
|
592 |
|
593 |
|
594 | (function(module, exports, __webpack_require__) {
|
595 |
|
596 | module.exports = __webpack_require__("./js/entries/plugins/foundation.equalizer.js");
|
597 |
|
598 |
|
599 | }),
|
600 |
|
601 | "jquery":
|
602 |
|
603 |
|
604 |
|
605 |
|
606 | (function(module, exports) {
|
607 |
|
608 | module.exports = __WEBPACK_EXTERNAL_MODULE_jquery__;
|
609 |
|
610 | })
|
611 |
|
612 | });
|
613 | });
|
614 |
|
\ | No newline at end of file |