From 563cea0dbe0f5e917301b5806d2f8cdb4c48e413 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Wilczy=C5=84ski?= Date: Sat, 29 Aug 2020 19:26:31 +0900 Subject: [PATCH] gui: Use indexOf instead of startsWith for IE11 compatibility (fixes #6940) (#6942) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- gui/default/syncthing/core/syncthingController.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gui/default/syncthing/core/syncthingController.js b/gui/default/syncthing/core/syncthingController.js index 8948ae760..fba23308e 100755 --- a/gui/default/syncthing/core/syncthingController.js +++ b/gui/default/syncthing/core/syncthingController.js @@ -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); } });