Browse Source

Clean up

pull/35/head
Zach Wise 13 years ago
parent
commit
18e347a385
  1. 124
      source/js/VMM.Core.js
  2. 124
      timeline.js

124
source/js/VMM.Core.js

@ -2,132 +2,12 @@
================================================== */
/* Sequence
================================================== */
if(typeof VMM != 'undefined' && typeof VMM.Sequence == 'undefined') {
VMM.Sequence = Class.extend({
initialize: function(length,index) {
trace('sequence init');
// PUBLIC
this.increment = 1;
this.decrement = 1;
this.wrap = false;
// PRIVATE
this.length = (length == null) ? 0 : length;
this.index = (index == null) ? ((length == 0) ? -1 : 0) : (index >= length) ? length-1 : index;
this.synced = [];
},
setLength: function(i) {
this.length = i;
this.setIndex(this.index);
},
getLength: function() {
return this.length;
},
setIndex: function(i) {
if(this.length <= 0) {
this.index = -1;
return;
}
if(i < 0) i = (this.wrap) ? this.length - (i%this.length) : 0;
else if(i >= this.length) i = (this.wrap) ? (i%this.length) : this.length-1;
var pi = this.index;
this.index = i;
if(pi != this.index) {
// update sequences
for(var j=0; j<this.synced.length; j++) {
var s = this.synced[j];
if(s.getIndex() != this.index) s.setIndex(this.index);
}
}
},
getIndex: function() {
return this.index;
},
next: function() {
this.setIndex(this.index+this.increment);
},
prev: function () {
this.setIndex(this.index-this.decrement);
},
sync: function(s,bothWays) {
if(s instanceof NYTMM.Sequence && s != this) {
this.synced.push(s);
if(bothWays) s.sync(this);
return true;
}
return false;
},
unsync: function(s,bothWays) {
// update sequences
for(var i=0; i<this.synced.length; i++) {
if(this.synced[i] == s) {
this.synced.splice(i,1);
if(bothWays) s.unsync(this);
return true;
}
}
return false;
}
});
}
/* Slider
================================================== */
if(typeof VMM != 'undefined' && typeof VMM.Slider == 'undefined') {
VMM.Slider = function(parent, content_width, content_height, is_timeline) {
/* DEVICE
================================================== */
/*
trace("VMM.Browser.OS");
trace(VMM.Browser.browser);
trace(VMM.Browser.version);
trace(VMM.Browser.OS);
trace(VMM.Browser.device);
*/
/* PRIVATE VARS
================================================== */
@ -359,12 +239,12 @@ if(typeof VMM != 'undefined' && typeof VMM.Slider == 'undefined') {
switch(e.keyCode) {
//right arrow
case 39:
onNextClick(e);
onNextClick(e);
break;
//left arrow
case 37:
onPrevClick(e);
onPrevClick(e);
break;
}
}

124
timeline.js

@ -2360,132 +2360,12 @@ if( typeof( jQuery ) != 'undefined' ){
================================================== */
/* Sequence
================================================== */
if(typeof VMM != 'undefined' && typeof VMM.Sequence == 'undefined') {
VMM.Sequence = Class.extend({
initialize: function(length,index) {
trace('sequence init');
// PUBLIC
this.increment = 1;
this.decrement = 1;
this.wrap = false;
// PRIVATE
this.length = (length == null) ? 0 : length;
this.index = (index == null) ? ((length == 0) ? -1 : 0) : (index >= length) ? length-1 : index;
this.synced = [];
},
setLength: function(i) {
this.length = i;
this.setIndex(this.index);
},
getLength: function() {
return this.length;
},
setIndex: function(i) {
if(this.length <= 0) {
this.index = -1;
return;
}
if(i < 0) i = (this.wrap) ? this.length - (i%this.length) : 0;
else if(i >= this.length) i = (this.wrap) ? (i%this.length) : this.length-1;
var pi = this.index;
this.index = i;
if(pi != this.index) {
// update sequences
for(var j=0; j<this.synced.length; j++) {
var s = this.synced[j];
if(s.getIndex() != this.index) s.setIndex(this.index);
}
}
},
getIndex: function() {
return this.index;
},
next: function() {
this.setIndex(this.index+this.increment);
},
prev: function () {
this.setIndex(this.index-this.decrement);
},
sync: function(s,bothWays) {
if(s instanceof NYTMM.Sequence && s != this) {
this.synced.push(s);
if(bothWays) s.sync(this);
return true;
}
return false;
},
unsync: function(s,bothWays) {
// update sequences
for(var i=0; i<this.synced.length; i++) {
if(this.synced[i] == s) {
this.synced.splice(i,1);
if(bothWays) s.unsync(this);
return true;
}
}
return false;
}
});
}
/* Slider
================================================== */
if(typeof VMM != 'undefined' && typeof VMM.Slider == 'undefined') {
VMM.Slider = function(parent, content_width, content_height, is_timeline) {
/* DEVICE
================================================== */
/*
trace("VMM.Browser.OS");
trace(VMM.Browser.browser);
trace(VMM.Browser.version);
trace(VMM.Browser.OS);
trace(VMM.Browser.device);
*/
/* PRIVATE VARS
================================================== */
@ -2717,12 +2597,12 @@ if(typeof VMM != 'undefined' && typeof VMM.Slider == 'undefined') {
switch(e.keyCode) {
//right arrow
case 39:
onNextClick(e);
onNextClick(e);
break;
//left arrow
case 37:
onPrevClick(e);
onPrevClick(e);
break;
}
}

Loading…
Cancel
Save