gui: Use indexOf instead of startsWith for IE11 compatibility (fixes #6940) (#6942)

Use indexOf() == 0 instead of startsWith() to maintain compatibility
and prevent JavaScript error console spam in the Web GUI when used in
Internet Explorer 11 under Windows 7.

Signed-off-by: Tomasz Wilczyński <twilczynski@naver.com>
This commit is contained in:
Tomasz Wilczyński 2020-08-29 19:26:31 +09:00 committed by GitHub
parent 55fddacdc2
commit 563cea0dbe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2012,7 +2012,7 @@ angular.module('syncthing.core')
filters: {},
massAction: function (name, action) {
$.each($scope.restoreVersions.versions, function (key) {
if (key.startsWith(name + '/') && (!$scope.restoreVersions.filters.text || key.indexOf($scope.restoreVersions.filters.text) > -1)) {
if (key.indexOf(name + '/') == 0 && (!$scope.restoreVersions.filters.text || key.indexOf($scope.restoreVersions.filters.text) > -1)) {
if (action == 'unset') {
delete $scope.restoreVersions.selections[key];
return;
@ -2525,8 +2525,8 @@ angular.module('syncthing.core')
$scope.isUnixAddress = function (address) {
return address != null &&
(address.startsWith('/') ||
address.startsWith('unix://') ||
address.startsWith('unixs://'));
(address.indexOf('/') == 0 ||
address.indexOf('unix://') == 0 ||
address.indexOf('unixs://') == 0);
}
});