Interactive interface for browsing global, full-resolution satellite imagery
WV-1128: Fixed mobile detection
Mike McGann7c6e30bf1163
diff --git a/deploy/wv.css.json b/deploy/wv.css.jsonindex 4c026bd64..a7e51a073 100644--- a/deploy/wv.css.json+++ b/deploy/wv.css.json@@ -19,5 +19,6 @@"web/css/global.css","web/css/wv.sidebar.css","web/css/wv.layers.options.css",- "web/css/new-ui.css"+ "web/css/new-ui.css",+ "web/css/wv.mobile.css"]diff --git a/web/css/products.css b/web/css/products.cssindex 326fd72b2..8dee0a4bf 100644--- a/web/css/products.css+++ b/web/css/products.css@@ -70,73 +70,6 @@border-bottom: 3px rgb(99,53,45) solid;}-@media only screen and (max-width: 720px) and (orientation: portrait), only screen and (max-height: 320px) and (orientation: landscape), only screen and (device-aspect-ratio: 2/3) and (orientation:portrait), only screen and (device-aspect-ratio:40/71) and (orientation:portrait){- .products {- display:block;- float:left;- left: 0;- min-width:238px;- width:100%;- height:100%;- position:absolute !important;- overflow:hidden;- background: rgb(38,43,49);- border-radius:0 10px 10px 0;- top:0; z-index: 10100;- }- .bank {- height:96%;- }- #selectorboxcontent { max-height:97%;}- .bank li.item a {float:right; color:#fff; margin-right:1.6em;}- img.bank-item-img { display:block; height: 1.6em; width:auto;}- #productsHolder li.third {- display:none;- }-- #wv-logo {- background: url("../brand/images/wv-logo-mobile.png?v=@BUILD_NONCE@") no-repeat center rgba(40, 40, 40, 0.85);- height: 42px;- width: 56px;- padding: 5px;- border-radius: 5px;- border: 1px solid #333;- }-- a.staticLayers {- width: 100px;- background-image: none;- border-radius: 5px;- top: 55px;- }-- a.staticLayers:hover {- background-image: none;- }-- #wv-toolbar li {- display: block;- float: left;- margin: 1px;- }-- #wv-toolbar #wv-image-button {- display: none;- }-- div.olControlScaleLineCustom {- bottom: 10px;- }-- .olControlScaleLineCustomBottom {- display: none;- }-- div.olControlMousePosition {- display: none;- }-}-.cats {float: right;margin-right:20px;@@ -175,5 +108,4 @@ ul#productsHoldertabs li.ui-state-active i.productsIcon {}@media screen and (max-device-height: 720px) and (orientation: landscape){- div.olControlMousePosition, div.olControlScaleLineCustom {display:none !important;}}diff --git a/web/css/wv.date.css b/web/css/wv.date.cssindex e8a9afe93..6871259a3 100644--- a/web/css/wv.date.css+++ b/web/css/wv.date.css@@ -185,7 +185,7 @@ div.ui-slider {border: 1px solid #333;position: absolute;left: 10px;- bottom: 10px;+ bottom: 85px;border: none;text-shadow: none;font-family: "Lucida Sans", "Arial", "sans serif";diff --git a/web/css/wv.main.css b/web/css/wv.main.cssindex 3de8d37d7..d054a0c31 100644--- a/web/css/wv.main.css+++ b/web/css/wv.main.css@@ -121,7 +121,6 @@ div.horizontalContainer {width:100%; display:block; float:left; position:absolu}@media screen and (max-width: 440px){- #wvlogo { width:54px; background-position: 0 center;}}#toolbarlist {diff --git a/web/css/wv.mobile.css b/web/css/wv.mobile.cssnew file mode 100644index 000000000..055a05a4a--- /dev/null+++ b/web/css/wv.mobile.css@@ -0,0 +1,84 @@+/* @media only screen and (max-width: 720px) and (orientation: portrait), only screen and (max-height: 320px) and (orientation: landscape), only screen and (device-aspect-ratio: 2/3) and (orientation:portrait), only screen and (device-aspect-ratio:40/71) and (orientation:portrait){ */+@media screen and (max-width: 720px), screen and (max-height: 720px) {+ .products {+ display:block;+ float:left;+ left: 0;+ min-width:238px;+ width:100%;+ height:100%;+ position:absolute !important;+ overflow:hidden;+ background: rgb(38,43,49);+ border-radius:0 10px 10px 0;+ top:0; z-index: 10100;+ }++ .bank {+ height:96%;+ }++ #selectorboxcontent {+ max-height:97%;+ }++ .bank li.item a {+ float:right;+ color:#fff;+ margin-right:1.6em;+ }++ img.bank-item-img {+ display:block;+ height: 1.6em;+ width:auto;+ }++ #productsHolder li.third {+ display:none;+ }++ #wv-logo {+ background: url("../brand/images/wv-logo-mobile.png?v=@BUILD_NONCE@") no-repeat center rgba(40, 40, 40, 0.85);+ height: 42px;+ width: 56px;+ padding: 5px;+ border-radius: 5px;+ border: 1px solid #333;+ }++ a.staticLayers {+ width: 100px;+ background-image: none;+ border-radius: 5px;+ top: 55px;+ }++ a.staticLayers:hover {+ background-image: none;+ }++ #wv-toolbar li {+ display: block;+ float: left;+ margin: 1px;+ }++ #wv-toolbar #wv-image-button {+ display: none;+ }++ div.olControlScaleLineCustom {+ bottom: 10px;+ }++ .olControlScaleLineCustomBottom {+ display: none;+ }++ div.olControlMousePosition {+ display: none;+ }++ div.olControlMousePosition, div.olControlScaleLineCustom {display:none !important;}+}diff --git a/web/index.html b/web/index.htmlindex b704f4037..1eb7387d7 100644--- a/web/index.html+++ b/web/index.html@@ -90,6 +90,7 @@<!-- link.dev --> <link type="text/css" rel="Stylesheet" href="css/wv.sidebar.css"><!-- link.dev --> <link type="text/css" rel="Stylesheet" href="css/wv.layers.options.css"><!-- link.dev --> <link type="text/css" rel="Stylesheet" href="css/new-ui.css">+ <!-- link.dev --> <link type="text/css" rel="Stylesheet" href="css/wv.mobile.css"><link type="text/css" rel="Stylesheet" href="pages/css/wv.document.css">diff --git a/web/js/layers/wv.layers.sidebar.js b/web/js/layers/wv.layers.sidebar.jsindex e62317a95..a6a7adc20 100644--- a/web/js/layers/wv.layers.sidebar.js+++ b/web/js/layers/wv.layers.sidebar.js@@ -259,11 +259,14 @@ wv.layers.sidebar = wv.layers.sidebar || function(models, config) {};var resize = function() {+ console.log("check");if ( !mobile && wv.util.browser.small ) {+ console.log("COLLAPSE");self.collapseNow();mobile = true;} else if ( mobile && !wv.util.browser.small ) {+ console.log("EXPAND");self.expandNow();mobile = false;}diff --git a/web/js/util/wv.util.browser.js b/web/js/util/wv.util.browser.jsindex 94d6d866d..2c14d4918 100644--- a/web/js/util/wv.util.browser.js+++ b/web/js/util/wv.util.browser.js@@ -92,8 +92,7 @@ wv.util.browser = wv.util.browser || (function() {self.localStorage = true;self.history = true;self.touchDevice = false;- self.mobileWidth = 720;- self.mobileHeight = 360;+ self.mobileSize = 720;var init = function() {var tests = self.tests;@@ -113,10 +112,13 @@ wv.util.browser = wv.util.browser || (function() {self.history = tests.history();self.touchDevice = tests.touchDevice();- $(window).resize(function() {+ var onResize = function() {self.small = tests.small();self.constrained = tests.constrained();- });+ console.log("small", wv.util.browser.small, "constrained", self.constrained, $(window).width(), $(window).height());+ };+ $(window).on("resize", onResize);+ onResize();};// The following functions should not be used directly. Use the values@@ -196,11 +198,11 @@ wv.util.browser = wv.util.browser || (function() {};self.tests.small = function() {- return $(window).width() < self.mobileWidth && $(window).height() < self.mobileHeight;+ return $(window).width() < self.mobileSize || $(window).height() < self.mobileSize;};self.tests.constrained = function() {- return $(window).width() < self.mobileWidth || $(window).height() < self.mobileHeight;+ return $(window).width() < self.mobileSize || $(window).height() < self.mobileSize;};self.tests.history = function() {@@ -210,7 +212,9 @@ wv.util.browser = wv.util.browser || (function() {return false;};- init();+ $(function() {+ init();+ });return self;})();