diff --git a/source/Ox.Image/Ox.Image.js b/source/Ox.Image/Ox.Image.js index 5eafb283..00d65c7b 100644 --- a/source/Ox.Image/Ox.Image.js +++ b/source/Ox.Image/Ox.Image.js @@ -143,7 +143,7 @@ Ox.load.Image = function(options, callback) { rgb = i == 0 ? Ox.rgb([val, 1, 0.5]) : Ox.range(3).map(function() { - return parseInt(val * 255); + return Math.floor(val * 255); }); return rgb.concat(rgba[3]); } diff --git a/source/Ox.UI/js/Form/DateInput.js b/source/Ox.UI/js/Form/DateInput.js index 4eadb708..a0198cf5 100644 --- a/source/Ox.UI/js/Form/DateInput.js +++ b/source/Ox.UI/js/Form/DateInput.js @@ -140,7 +140,7 @@ Ox.DateInput = function(options, self) { autocomplete: Ox.range(1, days + 1).map(function(i) { return self.options.format == 'short' ? Ox.pad(i, 2) : i.toString(); }), - value: self.options.format == 'short' ? Ox.pad(parseInt(day), 2) : day.toString() + value: self.options.format == 'short' ? Ox.pad(parseInt(day, 10), 2) : day.toString() }); self.options.value = join(); } diff --git a/source/Ox.UI/js/Form/Spreadsheet.js b/source/Ox.UI/js/Form/Spreadsheet.js index 5332a664..d7c8b488 100644 --- a/source/Ox.UI/js/Form/Spreadsheet.js +++ b/source/Ox.UI/js/Form/Spreadsheet.js @@ -220,7 +220,7 @@ Ox.Spreadsheet = function(options, self) { .appendTo(that); !isSum && self.$input[id].bindEvent({ change: function(data) { - self.options.value.values[r][c] = parseInt(data.value); + self.options.value.values[r][c] = parseInt(data.value, 10); self.sums = getSums(); self.$input[c + ',' + self.rows].value(self.sums.column[c]); self.$input[self.columns + ',' + r].value(self.sums.row[r]); diff --git a/source/Ox.UI/js/List/Chart.js b/source/Ox.UI/js/List/Chart.js index f37581b5..56645a87 100644 --- a/source/Ox.UI/js/List/Chart.js +++ b/source/Ox.UI/js/List/Chart.js @@ -74,7 +74,7 @@ Ox.Chart = function(options, self) { }); } self.sort[key] = key.replace(/(\d+)/g, function(number) { - return Ox.pad(parseInt(number), 16); + return Ox.pad(parseInt(number, 10), 16); }); }); self.max = Ox.max(self.totals); @@ -83,7 +83,7 @@ Ox.Chart = function(options, self) { if (self.subData) { Ox.forEach(self.subData, function(subValue, subKey) { self.sort[subKey] = subKey.replace(/(\d+)/g, function(number) { - return Ox.pad(parseInt(number), 16); + return Ox.pad(parseInt(number, 10), 16); }); }); self.subKeys = Object.keys(self.subData).sort(function(a, b) { diff --git a/source/Ox.UI/js/List/List.js b/source/Ox.UI/js/List/List.js index b1f4c60a..4c2a8bd8 100644 --- a/source/Ox.UI/js/List/List.js +++ b/source/Ox.UI/js/List/List.js @@ -598,7 +598,7 @@ Ox.List = function(options, self) { } function getPageByPosition(pos) { - return parseInt(pos / self.options.pageLength); + return Math.floor(pos / self.options.pageLength); } function getPageByScrollPosition(pos) { @@ -709,7 +709,7 @@ Ox.List = function(options, self) { function getScrollPosition() { // if orientation is both, this returns the // element position at the current scroll position - return parseInt( + return Math.floor( that.scrollTop() / (self.options.itemHeight + self.itemMargin) ) * self.rowLength; } @@ -930,7 +930,7 @@ Ox.List = function(options, self) { function move(data) { var clientY = data.clientY - that.offset()['top'], offset = clientY % 16, - position = Ox.limit(parseInt(clientY / 16), 0, self.$items.length - 1); + position = Ox.limit(Math.floor(clientY / 16), 0, self.$items.length - 1); if (position < self.drag.pos) { self.drag.stopPos = position + (offset > 8 ? 1 : 0); } else if (position > self.drag.pos) { diff --git a/source/Ox.UI/js/Menu/Menu.js b/source/Ox.UI/js/Menu/Menu.js index 20848561..853e93d9 100644 --- a/source/Ox.UI/js/Menu/Menu.js +++ b/source/Ox.UI/js/Menu/Menu.js @@ -414,7 +414,7 @@ Ox.Menu = function(options, self) { function scrollMenu(speed) { var containerHeight = that.$container.height(), contentHeight = that.$content.height(), - top = parseInt(that.$content.css('top')) || 0, + top = parseInt(that.$content.css('top'), 10) || 0, min = containerHeight - contentHeight + self.itemHeight, max = 0; top += speed * self.scrollSpeed * -self.itemHeight; @@ -516,7 +516,7 @@ Ox.Menu = function(options, self) { that.$container.height(that.$container.height() + self.itemHeight); } else { that.$content.css({ - top: ((parseInt(that.$content.css('top')) || 0) - offset) + 'px' + top: ((parseInt(that.$content.css('top'), 10) || 0) - offset) + 'px' }); } } @@ -546,7 +546,7 @@ Ox.Menu = function(options, self) { that.$container.height(that.$container.height() + self.itemHeight); } that.$content.css({ - top: ((parseInt(that.$content.css('top')) || 0) - offset) + 'px' + top: ((parseInt(that.$content.css('top'), 10) || 0) - offset) + 'px' }); } } diff --git a/source/Ox.UI/js/Panel/SplitPanel.js b/source/Ox.UI/js/Panel/SplitPanel.js index 105b2b8a..57503a40 100644 --- a/source/Ox.UI/js/Panel/SplitPanel.js +++ b/source/Ox.UI/js/Panel/SplitPanel.js @@ -58,8 +58,8 @@ Ox.SplitPanel = function(options, self) { size: 'auto' }, element); that.$elements[i] = element.element - .css(self.edges[2], (parseInt(element.element.css(self.edges[2])) || 0) + 'px') - .css(self.edges[3], (parseInt(element.element.css(self.edges[3])) || 0) + 'px'); + .css(self.edges[2], (parseInt(element.element.css(self.edges[2]), 10) || 0) + 'px') + .css(self.edges[3], (parseInt(element.element.css(self.edges[3]), 10) || 0) + 'px'); }); // create resizebars @@ -123,8 +123,8 @@ Ox.SplitPanel = function(options, self) { // is about elements that are collapsed splitpanels var css = {}, edges = [ - (init && parseInt(that.$elements[i].css(self.edges[0]))) || 0, - (init && parseInt(that.$elements[i].css(self.edges[1]))) || 0 + (init && parseInt(that.$elements[i].css(self.edges[0]), 10)) || 0, + (init && parseInt(that.$elements[i].css(self.edges[1]), 10)) || 0 ]; if (element.size != 'auto') { css[self.dimensions[0]] = element.size + 'px'; @@ -207,8 +207,8 @@ Ox.SplitPanel = function(options, self) { // one can pass pos instead of id var pos = Ox.isNumber(id) ? id : getPositionById(id); that.$elements[pos] = element - .css(self.edges[2], (parseInt(element.css(self.edges[2])) || 0) + 'px') - .css(self.edges[3], (parseInt(element.css(self.edges[3])) || 0) + 'px'); + .css(self.edges[2], (parseInt(element.css(self.edges[2]), 10) || 0) + 'px') + .css(self.edges[3], (parseInt(element.css(self.edges[3]), 10) || 0) + 'px'); Ox.Log('Panel', 'REPLACE ELEMENT') self.options.elements[pos].element.replaceWith( self.options.elements[pos].element = element @@ -307,9 +307,8 @@ Ox.SplitPanel = function(options, self) { // one can pass pos instead of id var pos = Ox.isNumber(id) ? id : getPositionById(id), element = self.options.elements[pos], - value = parseInt(that.css(self.edges[pos == 0 ? 0 : 1])) + - element.element[self.dimensions[0]]() * - (element.collapsed ? 1 : -1), + value = parseInt(that.css(self.edges[pos == 0 ? 0 : 1]), 10) + + element.element[self.dimensions[0]]() * (element.collapsed ? 1 : -1), animate = {}; animate[self.edges[pos == 0 ? 0 : 1]] = value; that.animate(animate, 250, function() { diff --git a/source/Ox.UI/js/Video/BlockVideoTimeline.js b/source/Ox.UI/js/Video/BlockVideoTimeline.js index 7a8c34c2..d936aab4 100644 --- a/source/Ox.UI/js/Video/BlockVideoTimeline.js +++ b/source/Ox.UI/js/Video/BlockVideoTimeline.js @@ -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' }); } diff --git a/source/Ox.UI/js/Video/LargeVideoTimeline.js b/source/Ox.UI/js/Video/LargeVideoTimeline.js index e823d2e3..8c525f89 100644 --- a/source/Ox.UI/js/Video/LargeVideoTimeline.js +++ b/source/Ox.UI/js/Video/LargeVideoTimeline.js @@ -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' }); diff --git a/source/Ox.UI/js/Video/VideoEditor.js b/source/Ox.UI/js/Video/VideoEditor.js index 61341e15..85b8c6e3 100644 --- a/source/Ox.UI/js/Video/VideoEditor.js +++ b/source/Ox.UI/js/Video/VideoEditor.js @@ -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 diff --git a/source/Ox.UI/js/Video/VideoEditorPlayer.js b/source/Ox.UI/js/Video/VideoEditorPlayer.js index 8b66dd08..0439f1e8 100644 --- a/source/Ox.UI/js/Video/VideoEditorPlayer.js +++ b/source/Ox.UI/js/Video/VideoEditorPlayer.js @@ -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)' }); } diff --git a/source/Ox.UI/js/Video/VideoPanel.js b/source/Ox.UI/js/Video/VideoPanel.js index 094a8ce4..3b1c8ca6 100644 --- a/source/Ox.UI/js/Video/VideoPanel.js +++ b/source/Ox.UI/js/Video/VideoPanel.js @@ -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}); diff --git a/source/Ox.UI/js/Video/VideoPlayer.js b/source/Ox.UI/js/Video/VideoPlayer.js index d881517d..dcdf6c70 100644 --- a/source/Ox.UI/js/Video/VideoPlayer.js +++ b/source/Ox.UI/js/Video/VideoPlayer.js @@ -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( diff --git a/source/Ox.UI/js/Video/VideoTimelinePanel.js b/source/Ox.UI/js/Video/VideoTimelinePanel.js index 43d208d4..18190d42 100644 --- a/source/Ox.UI/js/Video/VideoTimelinePanel.js +++ b/source/Ox.UI/js/Video/VideoTimelinePanel.js @@ -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}); diff --git a/source/Ox.js b/source/Ox.js index 3af9577e..a3ae69a0 100644 --- a/source/Ox.js +++ b/source/Ox.js @@ -95,7 +95,7 @@ window.Ox = { } else { element.onload = callback; } - element.src = path + script + '?' + parseInt(Math.random() * 1000000); + element.src = path + script + '?' + Math.floor(Math.random() * 1000000); element.type = 'text/javascript'; head.appendChild(element); } diff --git a/source/Ox/js/Array.js b/source/Ox/js/Array.js index 6c976bab..12f64d7d 100644 --- a/source/Ox/js/Array.js +++ b/source/Ox/js/Array.js @@ -570,7 +570,7 @@ Ox.range = function() { sort[value] = mappedValue.toLowerCase() .replace(/^\W+/, '') .replace(/\d+/g, function(match) { - return Ox.pad(parseInt(match), length); + return Ox.pad(parseInt(match, 10), length); }); Ox.forEach(['a', 'an', 'the'], function(article) { var length; diff --git a/source/Ox/js/Date.js b/source/Ox/js/Date.js index a05f53d5..1a609c93 100644 --- a/source/Ox/js/Date.js +++ b/source/Ox/js/Date.js @@ -261,7 +261,7 @@ Ox.makeYear Takes a date, number or string, returns a year 1970 @*/ Ox.makeYear = function(date, utc) { - return Ox.isDate(date) ? Ox.getFullYear(date, utc) : parseInt(date); + return Ox.isDate(date) ? Ox.getFullYear(date, utc) : parseInt(date, 10); }; /*@ diff --git a/source/Ox/js/Format.js b/source/Ox/js/Format.js index ff9dd0bb..734342fa 100644 --- a/source/Ox/js/Format.js +++ b/source/Ox/js/Format.js @@ -341,7 +341,7 @@ Ox.formatDateRange = function(start, end, utc) { ); parts.shift(); return parts.map(function(part) { - return parseInt(part); + return parseInt(part, 10); }); }), precision = parts.map(function(parts) { diff --git a/source/Ox/js/Math.js b/source/Ox/js/Math.js index 9f387665..92544ad3 100644 --- a/source/Ox/js/Math.js +++ b/source/Ox/js/Math.js @@ -62,7 +62,7 @@ Ox.divideInt Divides a number by another and returns an array of integers @*/ // fixme: is splitInt a better name? Ox.divideInt = function(number, by) { - var div = parseInt(number / by), + var div = Math.floor(number / by), mod = number % by; return Ox.range(by).map(function(i) { return div + (i > by - 1 - mod);