(window["webpackJsonp_name_"] = window["webpackJsonp_name_"] || []).push([[83],{ /***/ 433: /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _createClass = 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } /** * Retina - 2x/3x */ var ca_Retina = function () { _createClass(ca_Retina, [{ key: 'nodes', get: function get() { return this._params.nodes; } }], [{ key: 'default', get: function get() { return { nodes: null }; } }]); function ca_Retina(params) { _classCallCheck(this, ca_Retina); this._params = Object.assign({}, ca_Retina.default, params); var images = this.images = this.nodes; if (!images.length) { return; } var dataRetina = document.body.getAttribute('data-retina'); var ratio = window.devicePixelRatio; if (dataRetina) { if (dataRetina === '2x') { if (ratio > 2) { ratio = 2; } } else if (dataRetina === '3x') { if (ratio > 3) { ratio = 3; } } else { ratio = 1; } this._setRetina(Math.floor(ratio)); } else { this._setRetina(1); } } _createClass(ca_Retina, [{ key: '_setRetina', value: function _setRetina(ratio) { var images = this.images, length = images.length; var count = 0; [].forEach.call(images, function (img) { var attr = img.getAttribute('src'); if (!attr || attr === '#') { var src = img.getAttribute('data-' + ratio + 'x'); if (!src) { console.error('Sorry! Something going wrong with images!'); return false; } img.setAttribute('src', src); img.onload = function () { count++; if (count === length) { return true; } }; } else { count++; } }); } }]); return ca_Retina; }(); exports.default = ca_Retina; // document.addEventListener('DOMContentLoaded', () => { // new ca_Retina(); // }); /***/ }) }]);