/*! * viewport-units-buggyfill v0.6.2 * @web: https://github.com/rodneyrehm/viewport-units-buggyfill/ * @author: Rodney Rehm - http://rodneyrehm.de/en/ */ (function(){(function(a,b){if(typeof define==="function"&&define.amd){define([],b)}else{if(typeof exports==="object"){module.exports=b()}else{a.viewportUnitsBuggyfill=b()}}}(this,function(){var l=false;var i;var F=window.navigator.userAgent;var b=/([+-]?[0-9.]+)(vh|vw|vmin|vmax)/g;var s=/(https?:)?\/\//;var z=[].forEach;var p;var v;var E;var n=/MSIE [0-9]\./i.test(F);var q=/MSIE [0-8]\./i.test(F);var m=F.indexOf("Opera Mini")>-1;var d=/(iPhone|iPod|iPad).+AppleWebKit/i.test(F)&&(function(){var e=F.match(/OS (\d+)/);return e&&e.length>1&&parseInt(e[1])<10})();var x=(function(){var I=F.indexOf(" Android ")>-1;if(!I){return false}var H=F.indexOf("Version/")>-1;if(!H){return false}var e=parseFloat((F.match("Android ([0-9.]+)")||[])[1]);return e<=4.4})();if(!n){n=!!navigator.userAgent.match(/MSIE 10\.|Trident.*rv[ :]*1[01]\.| Edge\/1\d\./)}try{new u("test")}catch(C){var u=function(H,I){var e;I=I||{bubbles:false,cancelable:false,detail:undefined,};e=document.createEvent("CustomEvent");e.initCustomEvent(H,I.bubbles,I.cancelable,I.detail);return e};u.prototype=window.Event.prototype;window.CustomEvent=u}function j(e,I){var H;return function(){var K=this;var J=arguments;var L=function(){e.apply(K,J)};clearTimeout(H);H=setTimeout(L,I)}}function h(){try{return window.self!==window.top}catch(H){return true}}function c(e){if(l){return}if(e===true){e={force:true,}}i=e||{};i.isMobileSafari=d;i.isBadStockAndroid=x;if(i.ignoreVmax&&!i.force&&!q){n=false}if(q||(!i.force&&!d&&!n&&!x&&!m&&(!i.hacks||!i.hacks.required(i)))){if(window.console&&q){console.info("viewport-units-buggyfill requires a proper CSSOM and basic viewport unit support, which are not available in IE8 and below")}return{init:function(){},}}window.dispatchEvent(new u("viewport-units-buggyfill-init"));i.hacks&&i.hacks.initialize(i);l=true;E=document.createElement("style");E.id="patched-viewport";document[i.appendToBody?"body":"head"].appendChild(E);o(function(){var H=j(k,i.refreshDebounceWait||100);window.addEventListener("orientationchange",H,true);window.addEventListener("pageshow",H,true);if(i.force||n||h()){window.addEventListener("resize",H,true);i._listeningToResize=true}i.hacks&&i.hacks.initializeEvents(i,k,H);k()})}function B(){E.textContent=A();E.parentNode.appendChild(E);window.dispatchEvent(new u("viewport-units-buggyfill-style"))}function k(){if(!l){return}w();setTimeout(function(){B()},1)}function g(I){try{if(!I.cssRules){return}}catch(K){if(K.name!=="SecurityError"){throw K}return}var L=[];for(var H=0;H-1;if(!j){return}var f=h.replace(c,"");f.split(";").forEach(function(l){var n=l.split(":");if(n.length!==2){return}var m=n[0].trim();if(m==="viewport-units-buggyfill"){return}var p=n[1].trim();i.push([k,m,p]);if(e.test(p)){var o=p.replace(e,"-webkit-calc(");i.push([k,m,o])}})}return{required:function(f){return f.isMobileSafari||b},initialize:function(){},initializeEvents:function(g,h,f){if(g.force){return}if(b&&!g._listeningToResize){window.addEventListener("resize",f,true);g._listeningToResize=true}},findDeclarations:function(h,i,f,g){if(f===null){return}a(h,i,f,g)},overwriteDeclaration:function(h,g,f){if(b&&g==="filter"){f=f.replace(/px/g,"")}return f},}}))})();