Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/js/karma.js
diff options
context:
space:
mode:
authorBryan Berry <bryan@olenepal.org>2010-02-01 05:39:33 (GMT)
committer Bryan Berry <bryan@olenepal.org>2010-02-01 05:39:33 (GMT)
commit8adc6d0e39a1dec5d2e43c316d7bde1d18babed4 (patch)
treeb40c3e4582a0985a1804b6423be6b0b71c8f7834 /js/karma.js
parent2dcde719f3b7854110b15e2fc22ae3d5f6cb3fd7 (diff)
add scaleToViewport function to karma
Diffstat (limited to 'js/karma.js')
-rwxr-xr-xjs/karma.js20
1 files changed, 19 insertions, 1 deletions
diff --git a/js/karma.js b/js/karma.js
index cd813da..9c05837 100755
--- a/js/karma.js
+++ b/js/karma.js
@@ -241,7 +241,6 @@ Karma.convertNumToLocale = function(num, locale){
};
var charArray = num.toString().split("").map(convertDigit);
- console.log(charArray.join(''));
return eval('"' + charArray.join('') + '"');
};
@@ -257,6 +256,25 @@ Karma.convertNumToLocale = function(num, locale){
*/
Karma._n = Karma.convertNumToLocale;
+/* Scales the dimensions of document.body to the innerHeight and innerWidth
+ * of the viewport, i.e. browser window, with a minor offset to the height to
+ * make sure the scrollbars do not appear
+ */
+Karma.scaleToViewport = function(){
+ var width = window.innerWidth;
+ var height = window.innerHeight;
+
+ //hack to ensure scrollbars don't appear
+ if (height === 900){
+ height = "" + 884 + "px";
+ } else {
+ height = "" + (height - 13) + "px";
+ }
+
+ document.body.style.width = "" + width + "px";
+ document.body.style.height = height;
+};
+
// Below are geometry and math helper methods
/**