Return-Path: X-Original-To: apmail-cordova-commits-archive@www.apache.org Delivered-To: apmail-cordova-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 35D1918D18 for ; Mon, 19 Oct 2015 09:30:18 +0000 (UTC) Received: (qmail 64262 invoked by uid 500); 19 Oct 2015 09:30:18 -0000 Delivered-To: apmail-cordova-commits-archive@cordova.apache.org Received: (qmail 64237 invoked by uid 500); 19 Oct 2015 09:30:18 -0000 Mailing-List: contact commits-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list commits@cordova.apache.org Received: (qmail 64228 invoked by uid 99); 19 Oct 2015 09:30:18 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 19 Oct 2015 09:30:18 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id DC4CCDFD7A; Mon, 19 Oct 2015 09:30:17 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: an-selm@apache.org To: commits@cordova.apache.org Message-Id: <908d2f00e5ee409e90b70ccd36aabe10@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: cordova-plugin-test-framework git commit: CB-8973: Changed the functionality of making the log appear and disappear Date: Mon, 19 Oct 2015 09:30:17 +0000 (UTC) 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 Authored: Sat Oct 17 16:34:21 2015 +0300 Committer: daserge 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