aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBartek Szopka <bartek.szopka+github@gmail.com>2012-03-10 18:26:12 +0000
committerBartek Szopka <bartek.szopka+github@gmail.com>2012-03-10 18:26:12 +0000
commita20c50db258fbd3725b968da3343ead2af211196 (patch)
tree9d7e827f747598332647855d67bb0dbbafde7a9d
parent92181f58f0cbd2849445767d220279b296ef61fe (diff)
downloadimpress.js-a20c50db258fbd3725b968da3343ead2af211196.tar.gz
"making jshint (almost) happy"
-rw-r--r--js/impress.js47
1 files changed, 25 insertions, 22 deletions
diff --git a/js/impress.js b/js/impress.js
index bd10177..2795c94 100644
--- a/js/impress.js
+++ b/js/impress.js
@@ -44,7 +44,7 @@
}
return memory[ prop ];
- }
+ };
})();
@@ -57,13 +57,13 @@
for ( key in props ) {
if ( props.hasOwnProperty(key) ) {
pkey = pfx(key);
- if ( pkey != null ) {
+ if ( pkey !== null ) {
el.style[pkey] = props[key];
}
}
}
return el;
- }
+ };
var toNumber = function (numeric, fallback) {
return isNaN(numeric) ? (fallback || 0) : Number(numeric);
@@ -71,7 +71,7 @@
var byId = function ( id ) {
return document.getElementById(id);
- }
+ };
var $ = function ( selector, context ) {
context = context || document;
@@ -113,7 +113,7 @@
var body = document.body;
var ua = navigator.userAgent.toLowerCase();
- var impressSupported = ( pfx("perspective") != null ) &&
+ var impressSupported = ( pfx("perspective") !== null ) &&
( body.classList ) &&
( body.dataset ) &&
( ua.search(/(iphone)|(ipod)|(android)/) == -1 );
@@ -137,7 +137,7 @@
perspective: 1000,
- transitionDuration: 1000,
+ transitionDuration: 1000
};
var impress = window.impress = function ( rootId ) {
@@ -173,8 +173,8 @@
perspective: toNumber(rootData.perspective, defaults.perspective),
- transitionDuration: toNumber(rootData.transitionDuration, defaults.transitionDuration),
- }
+ transitionDuration: toNumber(rootData.transitionDuration, defaults.transitionDuration)
+ };
var canvas = document.createElement("div");
canvas.className = "canvas";
@@ -201,7 +201,7 @@
transformOrigin: "top left",
transition: "all 0s ease-in-out",
transformStyle: "preserve-3d"
- }
+ };
css(root, props);
css(root, {
@@ -319,7 +319,7 @@
rotate: {
x: -step.rotate.x,
y: -step.rotate.y,
- z: -step.rotate.z,
+ z: -step.rotate.z
},
translate: {
x: -step.translate.x,
@@ -341,11 +341,12 @@
windowScale = computeWindowScale();
}
+ var targetScale = target.scale * windowScale;
+
css(root, {
// to keep the perspective look similar for different scales
// we need to 'scale' the perspective, too
- transform: perspective( config.perspective / (target.scale * windowScale) )
- + scale(target.scale * windowScale),
+ transform: perspective( config.perspective / targetScale ) + scale( targetScale ),
transitionDuration: duration,
transitionDelay: (zoomin ? delay : "0ms")
});
@@ -394,7 +395,7 @@
prev: prev
});
- }
+ };
})(document, window);
// EVENTS
@@ -402,6 +403,8 @@
(function ( document, window ) {
'use strict';
+ var impress = window.impress;
+
// throttling function calls, by Remy Sharp
// http://remysharp.com/2010/07/21/throttling-function-calls/
var throttle = function (fn, delay) {
@@ -428,16 +431,16 @@
document.addEventListener("keyup", function ( event ) {
if ( event.keyCode == 9 || ( event.keyCode >= 32 && event.keyCode <= 34 ) || (event.keyCode >= 37 && event.keyCode <= 40) ) {
switch( event.keyCode ) {
- case 33: ; // pg up
- case 37: ; // left
- case 38: // up
+ case 33: // pg up
+ case 37: // left
+ case 38: // up
impress().prev();
break;
- case 9: ; // tab
- case 32: ; // space
- case 34: ; // pg down
- case 39: ; // right
- case 40: // down
+ case 9: // tab
+ case 32: // space
+ case 34: // pg down
+ case 39: // right
+ case 40: // down
impress().next();
break;
}
@@ -505,7 +508,7 @@
}, false);
// rescale presentation when window is resized
- window.addEventListener("resize", throttle(function (event) {
+ window.addEventListener("resize", throttle(function () {
// force going to active step again, to trigger rescaling
impress().stepTo( document.querySelector(".active"), true );
}, 250), false);