Permalink
Browse files

minor changes but I can't use duration() as a function as it is alrea…

…dy being used to id an element, can't really clobber an element
  • Loading branch information...
1 parent 84237ee commit 85d6ad15b69da252edd8cae0dece0bb192b57a56 @aackerman aackerman committed Dec 14, 2011
Showing with 7 additions and 15 deletions.
  1. +7 −15 interaction.js
View
@@ -66,7 +66,6 @@ var self = window.bezierLibrary = {
selectThumbnail: function() {
var selected = $('.selected', this.parentNode);
- var duration = getDurationValue();
if (selected) {
selected.classList.remove('selected');
@@ -79,7 +78,7 @@ var self = window.bezierLibrary = {
compare.style.cssText = this.style.cssText;
- compare.style.setProperty(prefix + 'transition-duration', duration + 's', null);
+ compare.style.setProperty(prefix + 'transition-duration', getDuration() + 's', null);
compareCanvas.bezier = this.bezier;
@@ -286,11 +285,10 @@ go.onclick = function() {
};
duration.oninput = function() {
- var value = getDurationValue();
-
- this.nextElementSibling.textContent = value + ' second' + (value == 1? '' : 's');
- current.style.setProperty(prefix + 'transition-duration', value + 's', null);
- compare.style.setProperty(prefix + 'transition-duration', value + 's', null);
+ var val = getDuration();
+ this.nextElementSibling.textContent = val + ' second' + (val == 1? '' : 's');
+ current.style.setProperty(prefix + 'transition-duration', val + 's', null);
+ compare.style.setProperty(prefix + 'transition-duration', val + 's', null);
};
window['import'].onclick = function() {
@@ -355,14 +353,8 @@ importexport.onsubmit = function() {
* Helper functions
*/
-function getDurationValue(){
- var value = Math.round(duration.value * 10) / 10;
-
- if(isNaN(value)) {
- return;
- }
-
- return value;
+function getDuration() {
+ return (isNaN(val = Math.round(duration.value * 10) / 10)) ? null : val;
}
function update() {

0 comments on commit 85d6ad1

Please sign in to comment.