You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by an...@apache.org on 2015/10/19 11:30:17 UTC

cordova-plugin-test-framework git commit: CB-8973: Changed the functionality of making the log appear and disappear

Repository: cordova-plugin-test-framework
Updated Branches:
  refs/heads/master 356aea5ea -> e9808da76


CB-8973: Changed the functionality of making the log appear and disappear

Fixes a typo classList.add -> classList.remove
Adds JS logic to adjust content/log height and margins on log show/hide and window resize for Windows platform


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-test-framework/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-test-framework/commit/e9808da7
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-test-framework/tree/e9808da7
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-test-framework/diff/e9808da7

Branch: refs/heads/master
Commit: e9808da76b6e10eb0ecba55d7631f6d138146122
Parents: 356aea5
Author: daserge <v-...@microsoft.com>
Authored: Sat Oct 17 16:34:21 2015 +0300
Committer: daserge <v-...@microsoft.com>
Committed: Sat Oct 17 16:36:34 2015 +0300

----------------------------------------------------------------------
 www/main.js | 38 ++++++++++++++++++++++++++++++++------
 1 file changed, 32 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-test-framework/blob/e9808da7/www/main.js
----------------------------------------------------------------------
diff --git a/www/main.js b/www/main.js
index 04d5045..f2a11cf 100644
--- a/www/main.js
+++ b/www/main.js
@@ -21,6 +21,11 @@
 
 'use strict';
 
+var LOG_HEADER_HEIGHT = 20,
+    CONTENT_TOP_OFFSET = 30;
+
+var isWin = cordova.platformId === "windows";
+
 /******************************************************************************/
 
 function getMode(callback) {
@@ -69,13 +74,34 @@ function setTitle(title) {
 /******************************************************************************/
 
 function setLogVisibility(visible) {
-  if (visible) {
-    document.querySelector('body').classList.add('expanded-log');
-  } else {
-    document.querySelector('body').classList.add('expanded-log');
-  }
+    if (visible) {
+        document.querySelector('body').classList.add('expanded-log');
+
+        var h = document.querySelector('body').offsetHeight;
+
+        if (isWin) {
+            document.getElementById('middle').style.height = (h * 0.6 - LOG_HEADER_HEIGHT - CONTENT_TOP_OFFSET) + "px";
+            document.getElementById('middle').style.marginBottom = (h * 0.4) + "px";
+            document.getElementById('middle').style.paddingBottom = (h * 0.4) + "px";
+        }
+    } else {
+        document.querySelector('body').classList.remove('expanded-log');
+
+        if (isWin) {
+            document.getElementById('middle').style.height = "";
+            document.getElementById('middle').style.marginBottom = "";
+            document.getElementById('middle').style.paddingBottom = "";
+        }
+    }
 }
 
+window.onresize = function (event) {
+    // Update content and log heights
+    if (isWin) {
+        setLogVisibility(getLogVisibility());
+    }
+};
+
 function getLogVisibility() {
   var e = document.querySelector('body');
   return e.classList.contains('expanded-log');
@@ -385,7 +411,7 @@ function runMain() {
       });
   }
 
-  if (cordova.platformId === "windows" && typeof WinJS !== 'undefined') {
+  if (isWin && typeof WinJS !== 'undefined') {
     var app = WinJS.Application;
     app.addEventListener("error", function (err) {
         // We do not want an unhandled exception to crash the test app


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org