From 699f5eaa5e6a1e254b1cb7c0224281545ad9ab87 Mon Sep 17 00:00:00 2001 From: Steve Belovarich Date: Mon, 15 Dec 2014 18:54:37 -0800 Subject: [PATCH] Update res.min.js --- res.min.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/res.min.js b/res.min.js index ddd2fb2..10729ec 100644 --- a/res.min.js +++ b/res.min.js @@ -1 +1 @@ -(function(){function e(e,t){t=t||{bubbles:false,cancelable:false,detail:undefined};var n=document.createEvent("CustomEvent");n.initCustomEvent(e,t.bubbles,t.cancelable,t.detail);return n}e.prototype=window.Event.prototype;window.CustomEvent=e})();var res=function(e){var t=this;this.uagent=navigator.userAgent.toLowerCase();this.state=undefined;this.input=undefined;this.orient=undefined;this.device=undefined;this.os=undefined;this.browser=undefined;this.version=undefined;this.width=0;this.grid={};this.viewports={};this.gridsettings={};var n=0;for(var r=0;r=e.viewports[t][0]&&e.width<=e.viewports[t][1]){if(e.state!=t){e.state=t;return e.state}}}}},inputCheck:function(){var e=this;if(e.os==="ios"||e.os==="android"||e.os==="winphone"){e.input="touch"}else{e.input="mouse"}},browserCheck:function(){var e=this;var t,n=e.uagent.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i)||[];if(/trident/i.test(n[1])){t=/\brv[ :]+(\d+)/g.exec(e.uagent)||[];return"IE "+(t[1]||"")}if(n[1]==="Chrome"){t=e.uagent.match(/\bOPR\/(\d+)/);if(t!=null){return"Opera "+t[1]}}n=n[2]?[n[1],n[2]]:[navigator.appName,navigator.appVersion,"-?"];if((t=e.uagent.match(/version\/(\d+)/i))!=null){n.splice(1,1,t[1])}e.browser=n[0];e.version=n[1];return n.join(" ")},osCheck:function(){var e=this;if(navigator.appVersion.indexOf("Win")!=-1){e.os="windows";e.device="desktop"}else if(navigator.appVersion.indexOf("Mac")!=-1&&navigator.userAgent.match(/(iPhone|iPod|iPad)/)==null){e.os="osx";e.device="desktop"}else if(navigator.userAgent.indexOf("Android")>-1){e.os="android";if(navigator.userAgent.indexOf("Mobile")>-1){e.device="mobile"}else{e.device="tablet"}}else if(navigator.userAgent.indexOf("windows phone")>0){e.os="windows";e.device="mobile"}else if(navigator.appVersion.indexOf("X11")!=-1){e.os="unix";e.device="desktop"}else if(navigator.appVersion.indexOf("Linux")!=-1){e.os="linux";e.device="desktop"}else if(navigator.userAgent.match(/(iPhone|iPod|iPad)/).length>0){e.os="ios";if(e.uagent.indexOf("iphone")>0){e.device="iphone"}if(e.uagent.indexOf("ipod")>0){e.device="ipod"}if(e.uagent.indexOf("ipad")>0){e.device="ipad"}}},gridHelper:function(e){var t=this;var n,r=[],i,s=[],o,u,a;a=t.gridsettings[e][0];o=t.gridsettings[e][1];u=t.gridsettings[e][2];n=[];i=[];width=window.innerWidth-o*2+u;columnWidth=width/a-u;for(var f=0;fwindow.innerWidth){e.orient="portrait"}else{e.orient="landscape"}e.setState();if(e.gridsettings.hasOwnProperty(e.state)){e.grid=e.gridHelper(e.state)}e.stateChange=new CustomEvent("stateChange",{bubbles:false,cancelable:true});window.dispatchEvent(e.stateChange);return e},init:function(){var e=this;e.osCheck();e.inputCheck();e.browserCheck();window.onorientationchange=function(){e.resize()};window.onresize=function(){e.resize()};e.resize()}} +!function(){function i(i,e){e=e||{bubbles:!1,cancelable:!1,detail:void 0};var t=document.createEvent("CustomEvent");return t.initCustomEvent(i,e.bubbles,e.cancelable,e.detail),t}i.prototype=window.Event.prototype,window.CustomEvent=i}();var res=function(i){var e=this;this.uagent=navigator.userAgent.toLowerCase(),this.state=void 0,this.input=void 0,this.orient=void 0,this.device=void 0,this.os=void 0,this.browser=void 0,this.version=void 0,this.width=0,this.grid={},this.viewports={},this.gridsettings={};for(var t=0,n=0;n=i.viewports[e][0]&&i.width<=i.viewports[e][1]&&i.state!=e)return i.state=e,i.state},inputCheck:function(){var i=this;i.input="ios"===i.os||"android"===i.os||"winphone"===i.os?"touch":"mouse"},browserCheck:function(){var i,e=this,t=e.uagent.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i)||[];return/trident/i.test(t[1])?(i=/\brv[ :]+(\d+)/g.exec(e.uagent)||[],"IE "+(i[1]||"")):"Chrome"===t[1]&&(i=e.uagent.match(/\bOPR\/(\d+)/),null!=i)?"Opera "+i[1]:(t=t[2]?[t[1],t[2]]:[navigator.appName,navigator.appVersion,"-?"],null!=(i=e.uagent.match(/version\/(\d+)/i))&&t.splice(1,1,i[1]),e.browser=t[0],e.version=t[1],t.join(" "))},osCheck:function(){var i=this;-1!=navigator.appVersion.indexOf("Win")?(i.os="windows",i.device="desktop"):-1!=navigator.appVersion.indexOf("Mac")&&null==navigator.userAgent.match(/(iPhone|iPod|iPad)/)?(i.os="osx",i.device="desktop"):navigator.userAgent.indexOf("Android")>-1?(i.os="android",i.device=navigator.userAgent.indexOf("Mobile")>-1?"mobile":"tablet"):navigator.userAgent.indexOf("windows phone")>0?(i.os="windows",i.device="mobile"):-1!=navigator.appVersion.indexOf("X11")?(i.os="unix",i.device="desktop"):-1!=navigator.appVersion.indexOf("Linux")?(i.os="linux",i.device="desktop"):navigator.userAgent.match(/(iPhone|iPod|iPad)/).length>0&&(i.os="ios",i.uagent.indexOf("iphone")>0&&(i.device="iphone"),i.uagent.indexOf("ipod")>0&&(i.device="ipod"),i.uagent.indexOf("ipad")>0&&(i.device="ipad"))},gridHelper:function(i){var e,t,n,o,r,s=this,a=[],d=[];r=s.gridsettings[i][0],n=s.gridsettings[i][1],o=s.gridsettings[i][2],e=[],t=[],width=window.innerWidth-2*n+o,columnWidth=width/r-o;for(var h=0;r>h;h++)t=0===h?0:columnWidth*h+o*(h-1),e=width/r*h+n,a.push(e),d.push(t),h===r-1&&(t=columnWidth*(h+1)+o*h,d.push(t));return{cols:r,col:a,colSpan:d,width:width,margin:n,gutter:o}},resize:function(){var i=this;return i.orient=window.innerHeight>window.innerWidth?"portrait":"landscape",i.setState(),i.gridsettings.hasOwnProperty(i.state)&&(i.grid=i.gridHelper(i.state)),i.stateChange=new CustomEvent("stateChange",{bubbles:!1,cancelable:!0}),window.dispatchEvent(i.stateChange),i},init:function(){var i=this;i.osCheck(),i.inputCheck(),i.browserCheck(),window.onorientationchange=function(){i.resize()},window.onresize=function(){i.resize()},i.resize()}};