diff --git a/root/static/js/canto-modules.js b/root/static/js/canto-modules.js index df54e1359..4b885a001 100644 --- a/root/static/js/canto-modules.js +++ b/root/static/js/canto-modules.js @@ -3,7 +3,7 @@ "use strict"; /*global history,curs_root_uri,angular,$,make_ontology_complete_url, - ferret_choose,application_root,window,curs_key, + ferret_choose,application_root,window,curs_key,removeIf, app_static_path,loadingStart,loadingEnd,alert,trim,read_only_curs */ var canto = angular.module('cantoApp', ['ui.bootstrap', 'angular-confirm', 'toaster', @@ -8618,9 +8618,8 @@ var annotationEditDialogCtrl = prevFeatureId !== featureId) { $.map($scope.annotation.extension, (orPart) => { - orPart.removeIf((ext) => { - if ($.grep(annotationType.clear_extensions_on_feature_change, - (rel) => rel == ext.relation)) { + removeIf(orPart, (ext) => { + if (annotationType.clear_extensions_on_feature_change.includes(ext.relation)) { toaster.pop({ type: 'warning', title: 'The ' + ext.relation + '(' + ext.rangeValue + diff --git a/root/static/js/canto.js b/root/static/js/canto.js index b06b2ee4d..aeaa3b04c 100644 --- a/root/static/js/canto.js +++ b/root/static/js/canto.js @@ -7,14 +7,14 @@ function trim(a) { a=a.replace(/^\s+/,''); return a.replace(/\s+$/,''); } -Array.prototype.removeIf = function(callback) { - var i = this.length; +function removeIf(arr, callback) { + var i = arr.length; while (i--) { - if (callback(this[i], i)) { - this.splice(i, 1); + if (callback(arr[i], i)) { + arr.splice(i, 1); } } -}; +} var loadingDiv = $('
');