use base 10 in parseInt, use Math.floor for numbers

This commit is contained in:
rolux 2012-06-13 10:28:21 +02:00
commit 8bc8c57373
19 changed files with 44 additions and 45 deletions

View file

@ -241,7 +241,7 @@ Ox.BlockVideoTimeline = function(options, self) {
var position = Math.round(self.options[point]);
self.$pointMarker[point].css({
left: (position % self.options.width) + 'px',
top: (parseInt(position / self.options.width) *
top: (Math.floor(position / self.options.width) *
(self.height + self.margin) + 15) + 'px'
});
}
@ -250,7 +250,7 @@ Ox.BlockVideoTimeline = function(options, self) {
var position = Math.round(self.options.position);
self.$positionMarker.css({
left: (position % self.options.width) - 1 + 'px',
top: (parseInt(position / self.options.width) *
top: (Math.floor(position / self.options.width) *
(self.height + self.margin) + 2) + 'px'
});
}

View file

@ -53,7 +53,7 @@ Ox.LargeVideoTimeline = function(options, self) {
$tooltip: Ox.Tooltip({
animate: false
}),
center: parseInt(self.options.width / 2),
center: Math.floor(self.options.width / 2),
element: that.$element[0],
fps: 25,
height: 64,
@ -154,7 +154,7 @@ Ox.LargeVideoTimeline = function(options, self) {
}
function setPosition() {
self.tile = parseInt(self.options.position * self.fps / self.tileWidth);
self.tile = Math.floor(self.options.position * self.fps / self.tileWidth);
self.$timeline.css({
marginLeft: (-self.options.position * self.fps) + 'px'
});
@ -199,7 +199,7 @@ Ox.LargeVideoTimeline = function(options, self) {
}
function setWidth() {
self.center = parseInt(self.options.width / 2);
self.center = Math.floor(self.options.width / 2);
that.css({
width: self.options.width + 'px'
});

View file

@ -559,7 +559,7 @@ Ox.VideoEditor = function(options, self) {
change: function(data) {
var id = data.id;
if (id == 'resolution') {
self.options.resolution = parseInt(data.checked[0].id);
self.options.resolution = parseInt(data.checked[0].id, 10);
self.$player[0].options({resolution: self.options.resolution});
} else if (id == 'size') {
toggleSize();
@ -1183,8 +1183,8 @@ Ox.VideoEditor = function(options, self) {
}
function setPosition(position, playing) {
var minute = minute = parseInt(position / 60),
previousMinute = parseInt(self.options.position / 60);
var minute = Math.floor(position / 60),
previousMinute = Math.floor(self.options.position / 60);
self.options.position = position;
!playing && self.$player[0].options({
position: self.options.position

View file

@ -330,9 +330,9 @@ Ox.VideoEditorPlayer = function(options, self) {
function setSubtitleSize() {
self.$subtitle.css({
bottom: parseInt(self.controlsHeight + self.options.height / 16) + 'px',
bottom: Math.floor(self.controlsHeight + self.options.height / 16) + 'px',
width: self.options.width + 'px',
fontSize: parseInt(self.options.height / 20) + 'px',
fontSize: Math.floor(self.options.height / 20) + 'px',
WebkitTextStroke: (self.options.height / 1000) + 'px rgb(0, 0, 0)'
});
}

View file

@ -416,8 +416,8 @@ Ox.VideoPanel = function(options, self) {
}
function setPosition(position, playing) {
var minute = parseInt(position / 60),
previousMinute = parseInt(self.options.position / 60);
var minute = Math.floor(position / 60),
previousMinute = Math.floor(self.options.position / 60);
self.options.position = position;
!playing && self.$video.options({position: self.options.position});
self.$timeline.options({position: self.options.position});

View file

@ -1338,9 +1338,9 @@ Ox.VideoPlayer = function(options, self) {
};
} else if (element == 'subtitle') {
css = {
bottom: (parseInt(self.height / 16) + !!self.controlsBottomAreVisible * 16) + 'px',
bottom: (Math.floor(self.height / 16) + !!self.controlsBottomAreVisible * 16) + 'px',
width: self.width + 'px',
fontSize: parseInt(self.height / 20) + 'px',
fontSize: Math.floor(self.height / 20) + 'px',
WebkitTextStroke: (self.height / 1000) + 'px rgb(0, 0, 0)'
};
} else if (element == 'spaceBottom' || element == 'timeline') {
@ -1543,8 +1543,8 @@ Ox.VideoPlayer = function(options, self) {
width = Math.round(width);
height = Math.round(height);
return {
left: parseInt((playerWidth - width) / 2),
top: parseInt((playerHeight - height) / 2),
left: Math.floor((playerWidth - width) / 2),
top: Math.floor((playerHeight - height) / 2),
width: width,
height: height
};
@ -1823,7 +1823,7 @@ Ox.VideoPlayer = function(options, self) {
} else if (title == 'Subtitles') {
toggleSubtitles();
} else {
resolution = parseInt(title);
resolution = parseInt(title, 10);
if (resolution != self.options.resolution) {
self.options.resolution = resolution;
setResolution();
@ -1837,7 +1837,7 @@ Ox.VideoPlayer = function(options, self) {
&& self.options.enableSubtitles
) || (
Ox.last(title) == 'p'
&& parseInt(title) == self.options.resolution
&& parseInt(title, 10) == self.options.resolution
);
$(children[1]).attr({
src: Ox.UI.getImageURL(

View file

@ -255,8 +255,8 @@ Ox.VideoTimelinePanel = function(options, self) {
}
function setPosition(position, playing) {
var minute = parseInt(position / 60),
previousMinute = parseInt(self.options.position / 60);
var minute = Math.floor(position / 60),
previousMinute = Math.floor(self.options.position / 60);
self.options.position = position;
!playing && self.$player.options({position: self.options.position});
self.$annotationPanel.options({position: self.options.position});