-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathupyachka.min.js
7 lines (7 loc) · 2.89 KB
/
upyachka.min.js
1
2
3
4
5
6
7
/*!
upyachka.js 0.2.0 | https://github.com/artpolikarpov/upyachka.js
*/
!function t(e,n,r){function i(d,u){if(!n[d]){if(!e[d]){var a="function"==typeof require&&require;if(!u&&a)return a(d,!0);if(o)return o(d,!0);throw new Error("Cannot find module '"+d+"'")}var h=n[d]={exports:{}};e[d][0].call(h.exports,function(t){var n=e[d][1][t];return i(n?n:t)},h,h.exports,t,e,n,r)}return n[d].exports}for(var o="function"==typeof require&&require,d=0;d<r.length;d++)i(r[d]);return i}({1:[function(t,e){/*!
* domready (c) Dustin Diaz 2014 - License MIT
*/
!function(t,n){"undefined"!=typeof e?e.exports=n():"function"==typeof define&&"object"==typeof define.amd?define(n):this[t]=n()}("domready",function(){var t,e=[],n=document,r="DOMContentLoaded",i=/^loaded|^i|^c/.test(n.readyState);return i||n.addEventListener(r,t=function(){for(n.removeEventListener(r,t),i=1;t=e.shift();)t()}),function(t){i?t():e.push(t)}})},{}],2:[function(t){var e,n,r,i,o;r=t("domready"),o=t("./width-or-height/width-or-height.js"),e=function(t,e,n){return t.addEventListener?t.addEventListener(e,n,!1):t.attachEvent?t.attachEvent("on"+e,n,!1):void 0},i=function(t,e,n){return t.removeEventListener?t.removeEventListener(e,n,!1):t.detachEvent?t.detachEvent("on"+e,n,!1):void 0},n=function(t){var n,r,d,u,a,h,f;return h=t.getAttribute("style"),n=t.className,r=!0,o(t,"width")&&o(t,"height")?void console.log("# Not a responsive image, exit",o(t,"width"),o(t,"height")):(d=function(){return t.style.height=Math.round(o(t,"width")/a)+"px"},t.onload=function(){return h?t.setAttribute("style",h):t.removeAttribute("style"),r=!1,t.className=n,i(window,"resize",d)},f=t.getAttribute("width"),u=t.getAttribute("height"),a=f/u,r?(t.className+=" upyachka",d(),e(window,"resize",d)):void 0)},r(function(){var t,e,r,i,o;for(i=document.getElementsByTagName("img"),o=[],e=0,r=i.length;r>e;e++)t=i[e],t.getAttribute("width")&&t.getAttribute("height")&&t.getAttribute("src")&&o.push(n(t));return o})},{"./width-or-height/width-or-height.js":3,domready:1}],3:[function(t,e){function n(t){return t.ownerDocument.defaultView.getComputedStyle(t,null)}function r(t){return t-parseFloat(t)>=0}function i(t,e,n,i){var d,u;return void 0===d&&(d=o(t,e,i)),""===n||n?(u=parseFloat(d),n===!0||r(u)?u||0:d):d}function o(t,e,r){var i,o,d=t.style;return r=r||n(t),r&&(o=r[e],h.test(o)&&(i=d.width,d.width=o,o=r.width,d.width=i)),void 0!==o?o+"":o}function d(t,e,n,r,o){for(var d=n===(r?"border":"content")?4:"width"===e?1:0,a=0;4>d;d+=2)"margin"===n&&(a+=i(t,n+u[d],!0,o)),r?("content"===n&&(a-=i(t,"padding"+u[d],!0,o)),"margin"!==n&&(a-=i(t,"border"+u[d]+"Width",!0,o))):(a+=i(t,"padding"+u[d],!0,o),"padding"!==n&&(a+=i(t,"border"+u[d]+"Width",!0,o)));return a}var u=["Top","Right","Bottom","Left"],a=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,h=new RegExp("^("+a+")(?!px)[a-z%]+$","i");e.exports=function(t,e){var r="width"===e?t.offsetWidth:t.offsetHeight,i=n(t);return r+d(t,e,"content",!0,i)}},{}]},{},[2]);