diff --git a/source/Ox.Image/Ox.Image.js b/source/Ox.Image/Ox.Image.js
index 2c95526c..c4f6eb64 100644
--- a/source/Ox.Image/Ox.Image.js
+++ b/source/Ox.Image/Ox.Image.js
@@ -355,7 +355,7 @@ Ox.load.Image = function(options, callback) {
while (str.length < cap) {
str += str.substr(4, len);
}
- str = str.substr(0, Math.ceil(cap));
+ str = str.slice(0, Math.ceil(cap));
// Create an array of bit values
bin = Ox.flatten(Ox.map(str.split(''), function(chr) {
return Ox.range(8).map(function(i) {
diff --git a/source/Ox.UI/js/Code/Ox.SourceViewer.js b/source/Ox.UI/js/Code/Ox.SourceViewer.js
index 36dae3f0..a3a2f836 100644
--- a/source/Ox.UI/js/Code/Ox.SourceViewer.js
+++ b/source/Ox.UI/js/Code/Ox.SourceViewer.js
@@ -30,7 +30,7 @@ Ox.SourceViewer = function(options, self) {
return match ? match[0].length : 0;
}));
return '
' + lines.map(function(line) {
- return line.substr(indent);
+ return line.slice(indent);
}).join('\n') + '';
}
]
diff --git a/source/Ox.UI/js/Core/Ox.URL.js b/source/Ox.UI/js/Core/Ox.URL.js
index 59edf95b..fadc202d 100644
--- a/source/Ox.UI/js/Core/Ox.URL.js
+++ b/source/Ox.UI/js/Core/Ox.URL.js
@@ -336,10 +336,10 @@ Ox.URL = function(options) {
}
if (['=', '!='].indexOf(condition.operator) > -1) {
if (condition.value[0] == '*') {
- condition.value = condition.value.substr(1);
+ condition.value = condition.value.slice(1);
condition.operator = condition.operator.replace('=', '$')
} else if (condition.value[condition.value.length - 1] == '*') {
- condition.value = condition.value.substr(0, condition.value.length - 1);
+ condition.value = condition.value.slice(0, -1);
condition.operator = condition.operator.replace('=', '^')
}
}
@@ -417,7 +417,7 @@ Ox.URL = function(options) {
return str.split(',').map(function(str) {
var hasOperator = /^[\+-]/.test(str);
return {
- key: hasOperator ? str.substr(1) : str,
+ key: hasOperator ? str.slice(1) : str,
operator: hasOperator
? str[0]
: Ox.getObjectById(self.options.sortKeys[state.type][
diff --git a/source/Ox.UI/js/Form/Ox.Button.js b/source/Ox.UI/js/Form/Ox.Button.js
index c8cad30b..09d96264 100644
--- a/source/Ox.UI/js/Form/Ox.Button.js
+++ b/source/Ox.UI/js/Form/Ox.Button.js
@@ -113,7 +113,7 @@ Ox.Button = function(options, self) {
that.attr({
src: Ox.UI.getImageURL(
'symbol' + self.options.title[0].toUpperCase()
- + self.options.title.substr(1)
+ + self.options.title.slice(1)
)
});
} else {
diff --git a/source/Ox.UI/js/Form/Ox.Input.js b/source/Ox.UI/js/Form/Ox.Input.js
index b761d370..ae6f7849 100644
--- a/source/Ox.UI/js/Form/Ox.Input.js
+++ b/source/Ox.UI/js/Form/Ox.Input.js
@@ -513,7 +513,7 @@ Ox.Input = function(options, self) {
} else if (/\./.test(value) && self.options.decimals) {
length = value.split('.')[1].length;
if (length > self.options.decimals) {
- value = value.substr(0, value.indexOf('.') + 1 + self.options.decimals);
+ value = value.slice(0, value.indexOf('.') + 1 + self.options.decimals);
cursor = [oldCursor[0] + 1, oldCursor[1] + 1];
} else if (length < self.options.decimals) {
value += Ox.repeat('0', self.options.decimals - length);
@@ -527,7 +527,7 @@ Ox.Input = function(options, self) {
}
}
while (/^0\d/.test(value)) {
- value = value.substr(1, value.length);
+ value = value.slice(1);
}
if (!regexp.test(value) || value < self.options.min || value > self.options.max) {
value = oldValue;
@@ -725,7 +725,7 @@ Ox.Input = function(options, self) {
that.triggerEvent('insert', {
end: input.selectionEnd,
id: that.oxid,
- selection: input.value.substring(input.selectionStart, input.selectionEnd),
+ selection: input.value.slice(input.selectionStart, input.selectionEnd),
start: input.selectionStart,
value: input.value
});
@@ -734,7 +734,7 @@ Ox.Input = function(options, self) {
function keydown(event) {
var oldCursor = cursor(),
oldValue = self.options.value,
- newValue = oldValue.substr(0, oldCursor[0] - 1),
+ newValue = oldValue.slice(0, oldCursor[0] - 1),
hasDeletedSelectedEnd = (event.keyCode == 8 || event.keyCode == 46) &&
oldCursor[0] < oldCursor[1] && oldCursor[1] == oldValue.length;
if (
diff --git a/source/Ox.UI/js/Form/Ox.InsertHTMLDialog.js b/source/Ox.UI/js/Form/Ox.InsertHTMLDialog.js
index 248258a3..6d13b52d 100644
--- a/source/Ox.UI/js/Form/Ox.InsertHTMLDialog.js
+++ b/source/Ox.UI/js/Form/Ox.InsertHTMLDialog.js
@@ -190,9 +190,9 @@ Ox.InsertHTMLDialog = function(options, self) {
);
self.options.callback({
position: self.options.start + value.length,
- value: self.options.value.substr(0, self.options.start)
+ value: self.options.value.slice(0, self.options.start)
+ value
- + self.options.value.substr(self.options.end)
+ + self.options.value.slice(self.options.end)
});
that.close();
}
diff --git a/source/Ox.UI/js/Form/Ox.TimeInput.js b/source/Ox.UI/js/Form/Ox.TimeInput.js
index 6e6b0e02..3392b569 100644
--- a/source/Ox.UI/js/Form/Ox.TimeInput.js
+++ b/source/Ox.UI/js/Form/Ox.TimeInput.js
@@ -119,7 +119,7 @@ Ox.TimeInput = function(options, self) {
function getDate() {
return new Date('1970/01/01 ' + (
self.options.milliseconds
- ? self.options.value.substr(0, self.options.value.length - 4)
+ ? self.options.value.slice(0, -4)
: self.options.value
));
}
@@ -129,7 +129,7 @@ Ox.TimeInput = function(options, self) {
return {
ampm: Ox.formatDate(date, '%p'),
hours: Ox.formatDate(date, self.options.ampm ? '%I' : '%H'),
- milliseconds: self.options.milliseconds ? self.options.value.substr(-3) : '000',
+ milliseconds: self.options.milliseconds ? self.options.value.slice(-3) : '000',
minutes: Ox.formatDate(date, '%M'),
seconds: Ox.formatDate(date, '%S')
};
diff --git a/source/Ox.UI/js/Map/Ox.ListMap.js b/source/Ox.UI/js/Map/Ox.ListMap.js
index 451dd10c..0c775163 100644
--- a/source/Ox.UI/js/Map/Ox.ListMap.js
+++ b/source/Ox.UI/js/Map/Ox.ListMap.js
@@ -774,7 +774,7 @@ Ox.ListMap = function(options, self) {
country = Ox.getCountryByGeoname(place.geoname);
place.countryCode = country ? country.code : '';
if (!self.isAsync) {
- place.id = self.selectedPlace.substr(1); // fixme: safe?
+ place.id = self.selectedPlace.slice(1); // fixme: safe?
self.selectedPlace = place.id;
self.options.places.push(place);
self.$list.options({
diff --git a/source/Ox.UI/js/Video/Ox.AnnotationPanel.js b/source/Ox.UI/js/Video/Ox.AnnotationPanel.js
index 4bba3994..1bbf5f42 100644
--- a/source/Ox.UI/js/Video/Ox.AnnotationPanel.js
+++ b/source/Ox.UI/js/Video/Ox.AnnotationPanel.js
@@ -302,8 +302,9 @@ Ox.AnnotationPanel = function(options, self) {
insert({
end: element.selectionEnd,
id: id,
- selection: element.value
- .substr(element.selectionStart, element.selectionEnd),
+ selection: element.value.slice(
+ element.selectionStart, element.selectionEnd
+ ),
start: element.selectionStart,
value: element.value
});
diff --git a/source/Ox.UI/js/Video/Ox.VideoElement.js b/source/Ox.UI/js/Video/Ox.VideoElement.js
index b1129857..29d250b5 100644
--- a/source/Ox.UI/js/Video/Ox.VideoElement.js
+++ b/source/Ox.UI/js/Video/Ox.VideoElement.js
@@ -89,7 +89,7 @@ Ox.VideoElement = function(options, self) {
item.$videos = src.map(function(src, i) {
// in all browsers except firefox,
// loadedmetadata fires only once per src
- if(Ox.parseURL(src).protocol.substr(0, 4) == 'http') {
+ if (Ox.startsWith(Ox.parseURL(src).protocol, 'http')) {
src += '?' + Ox.uid();
}
return $('