Use substring instead of substr since it's deprecated.
This commit is contained in:
parent
211646c874
commit
41c459897f
@ -112,7 +112,7 @@
|
||||
window.onload = function () {
|
||||
let scriptElement = document.createElement ('script');
|
||||
scriptElement.type = 'text/javascript';
|
||||
scriptElement.src = window.location.hash.substr (1);
|
||||
scriptElement.src = window.location.hash.substring (1);
|
||||
scriptElement.onload = () => {
|
||||
Sandbox3D ();
|
||||
};
|
||||
|
||||
@ -170,7 +170,7 @@ export class ImporterPly extends ImporterBase
|
||||
if (checkResult === PlyHeaderCheckResult.Ok) {
|
||||
if (header.format === 'ascii') {
|
||||
let contentString = ArrayBufferToUtf8String (fileContent);
|
||||
contentString = contentString.substr (headerString.length);
|
||||
contentString = contentString.substring (headerString.length);
|
||||
this.ReadAsciiContent (header, contentString);
|
||||
} else if (header.format === 'binary_little_endian' || header.format === 'binary_big_endian') {
|
||||
this.ReadBinaryContent (header, fileContent, headerString.length);
|
||||
|
||||
@ -2,10 +2,10 @@ import { IsLower } from '../geometry/geometry.js';
|
||||
|
||||
export function NameFromLine (line, startIndex, commentChar)
|
||||
{
|
||||
let name = line.substr (startIndex);
|
||||
let name = line.substring (startIndex);
|
||||
let commentStart = name.indexOf (commentChar);
|
||||
if (commentStart !== -1) {
|
||||
name = name.substr (0, commentStart);
|
||||
name = name.substring (0, commentStart);
|
||||
}
|
||||
return name.trim ();
|
||||
}
|
||||
@ -15,7 +15,7 @@ export function ParametersFromLine (line, commentChar)
|
||||
if (commentChar !== null) {
|
||||
let commentStart = line.indexOf (commentChar);
|
||||
if (commentStart !== -1) {
|
||||
line = line.substr (0, commentStart).trim ();
|
||||
line = line.substring (0, commentStart).trim ();
|
||||
}
|
||||
}
|
||||
return line.split (/\s+/u);
|
||||
@ -34,11 +34,11 @@ export function ReadLines (str, onLine)
|
||||
let cursor = 0;
|
||||
let next = str.indexOf ('\n', cursor);
|
||||
while (next !== -1) {
|
||||
LineFound (str.substr (cursor, next - cursor), onLine);
|
||||
LineFound (str.substring (cursor, next), onLine);
|
||||
cursor = next + 1;
|
||||
next = str.indexOf ('\n', cursor);
|
||||
}
|
||||
LineFound (str.substr (cursor), onLine);
|
||||
LineFound (str.substring (cursor), onLine);
|
||||
}
|
||||
|
||||
export function IsPowerOfTwo (x)
|
||||
|
||||
@ -48,8 +48,8 @@ export function Base64DataURIToArrayBuffer (uri)
|
||||
return null;
|
||||
}
|
||||
|
||||
let mimeType = uri.substr (dataPrefix.length, mimeSeparator - 5);
|
||||
let base64String = atob (uri.substr (bufferSeparator + 1));
|
||||
let mimeType = uri.substring (dataPrefix.length, dataPrefix.length + mimeSeparator - 5);
|
||||
let base64String = atob (uri.substring (bufferSeparator + 1));
|
||||
let buffer = new ArrayBuffer (base64String.length);
|
||||
let bufferView = new Uint8Array (buffer);
|
||||
for (let i = 0; i < base64String.length; i++) {
|
||||
|
||||
@ -19,11 +19,11 @@ export function GetFileName (filePath)
|
||||
}
|
||||
let fileName = filePath;
|
||||
if (firstSeparator !== -1) {
|
||||
fileName = filePath.substr (firstSeparator + 1);
|
||||
fileName = filePath.substring (firstSeparator + 1);
|
||||
}
|
||||
let firstParamIndex = fileName.indexOf ('?');
|
||||
if (firstParamIndex !== -1) {
|
||||
fileName = fileName.substr (0, firstParamIndex);
|
||||
fileName = fileName.substring (0, firstParamIndex);
|
||||
}
|
||||
return decodeURI (fileName);
|
||||
}
|
||||
@ -35,7 +35,7 @@ export function GetFileExtension (filePath)
|
||||
if (firstPoint === -1) {
|
||||
return '';
|
||||
}
|
||||
let extension = fileName.substr (firstPoint + 1);
|
||||
let extension = fileName.substring (firstPoint + 1);
|
||||
return extension.toLowerCase ();
|
||||
}
|
||||
|
||||
@ -102,7 +102,7 @@ export function TransformFileHostUrls (urls)
|
||||
url = url.replace ('www.dropbox.com', 'dl.dropbox.com');
|
||||
let separatorPos = url.indexOf ('?');
|
||||
if (separatorPos !== -1) {
|
||||
url = url.substr (0, separatorPos);
|
||||
url = url.substring (0, separatorPos);
|
||||
}
|
||||
urls[i] = url;
|
||||
} else if (url.search (/github\.com/u) !== -1) {
|
||||
@ -110,7 +110,7 @@ export function TransformFileHostUrls (urls)
|
||||
url = url.replace ('/blob', '');
|
||||
let separatorPos = url.indexOf ('?');
|
||||
if (separatorPos !== -1) {
|
||||
url = url.substr (0, separatorPos);
|
||||
url = url.substring (0, separatorPos);
|
||||
}
|
||||
urls[i] = url;
|
||||
}
|
||||
|
||||
@ -75,9 +75,9 @@ export function HexStringToColor (hexString)
|
||||
return null;
|
||||
}
|
||||
|
||||
let r = parseInt (hexString.substr (0, 2), 16);
|
||||
let g = parseInt (hexString.substr (2, 2), 16);
|
||||
let b = parseInt (hexString.substr (4, 2), 16);
|
||||
let r = parseInt (hexString.substring (0, 2), 16);
|
||||
let g = parseInt (hexString.substring (2, 4), 16);
|
||||
let b = parseInt (hexString.substring (4, 6), 16);
|
||||
return new Color (r, g, b);
|
||||
}
|
||||
|
||||
|
||||
@ -244,7 +244,7 @@ export class ParameterListParser
|
||||
for (let i = 0; i < urlParts.length; i++) {
|
||||
let urlPart = urlParts[i];
|
||||
if (urlPart.startsWith (keywordToken)) {
|
||||
return urlPart.substr (keywordToken.length);
|
||||
return urlPart.substring (keywordToken.length);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
||||
@ -15,7 +15,7 @@ export function CookieGetStringVal (key, defVal)
|
||||
for (let i = 0; i < cookieParts.length; i++) {
|
||||
let currentCookie = cookieParts[i].trim ();
|
||||
if (currentCookie.startsWith (key + '=')) {
|
||||
return currentCookie.substr (key.length + 1);
|
||||
return currentCookie.substring (key.length + 1);
|
||||
}
|
||||
}
|
||||
return defVal;
|
||||
|
||||
@ -68,7 +68,7 @@ export class HashHandler
|
||||
|
||||
GetHash ()
|
||||
{
|
||||
return window.location.hash.substr (1);
|
||||
return window.location.hash.substring (1);
|
||||
}
|
||||
|
||||
SetHash (hash)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user