From a1d6efd56a7bef5cbbe08c56106d30b781673293 Mon Sep 17 00:00:00 2001 From: Matthew Schranz Date: Tue, 2 Jun 2015 11:48:57 -0400 Subject: [PATCH] fix(ie): Remove usage of const. - const is not supported in IE until version 11. This was causing the app to crash. Closes #838, #805 --- app/scripts/cart/cart.table.model.ts | 16 ++++++------ app/scripts/components/gql/module.ts | 18 ++++++------- .../components/location/location.services.ts | 6 ++--- app/scripts/projects/projects.table.model.ts | 14 +++++----- .../search/search.files.table.model.ts | 16 ++++++------ .../search/search.participants.table.model.ts | 26 +++++++++---------- 6 files changed, 48 insertions(+), 48 deletions(-) diff --git a/app/scripts/cart/cart.table.model.ts b/app/scripts/cart/cart.table.model.ts index c7c44e50a..422e74d8f 100644 --- a/app/scripts/cart/cart.table.model.ts +++ b/app/scripts/cart/cart.table.model.ts @@ -1,15 +1,15 @@ module ngApp.cart.models { function withAnnotationFilter(value: number, filters: Object[], $filter: ng.IFilterService): string { - const filterString = $filter("makeFilter")(filters, true); - const href = 'annotations?filters=' + filterString; - const val = '{{' + value + '|number:0}}'; + var filterString = $filter("makeFilter")(filters, true); + var href = 'annotations?filters=' + filterString; + var val = '{{' + value + '|number:0}}'; return "" + val + ''; } function withFilter(value: number, filters: Object[], $filter: ng.IFilterService): string { - const filterString = $filter("makeFilter")(filters, true); - const href = 'search/p?filters=' + filterString; - const val = '{{' + value + '|number:0}}'; + var filterString = $filter("makeFilter")(filters, true); + var href = 'search/p?filters=' + filterString; + var val = '{{' + value + '|number:0}}'; return "" + val + ''; } @@ -30,8 +30,8 @@ module ngApp.cart.models { name: "My Projects", id: "my_projects", td: (row, $scope) => { - const isUserProject = $scope.UserService.isUserProject(row); - const icon = isUserProject ? 'check-square-o' : 'square-o'; + var isUserProject = $scope.UserService.isUserProject(row); + var icon = isUserProject ? 'check-square-o' : 'square-o'; return ''; }, inactive: $scope => !$scope.UserService.currentUser, diff --git a/app/scripts/components/gql/module.ts b/app/scripts/components/gql/module.ts index 920840371..6ce84e429 100644 --- a/app/scripts/components/gql/module.ts +++ b/app/scripts/components/gql/module.ts @@ -26,8 +26,8 @@ module ngApp.components.gql { return element.selectionStart; } else if (this.$document['selection']) { element.focus(); - const sel: any = this.$document['selection'].createRange(); - const selLen: number = this.$document['selection'].createRange().text.length; + var sel: any = this.$document['selection'].createRange(); + var selLen: number = this.$document['selection'].createRange().text.length; sel.moveStart('character', -element.value.length); return sel.text.length - selLen; } @@ -35,7 +35,7 @@ module ngApp.components.gql { setPos(element: any, caretPos: number): void { if (element.createTextRange) { - const range = element.createTextRange(); + var range = element.createTextRange(); range.move('character', caretPos); range.select(); } else { @@ -56,14 +56,14 @@ module ngApp.components.gql { } isUnbalanced(stack: string, start: string, end: string): boolean { - const numStart = this.countNeedle(stack, start); - const numEnd = this.countNeedle(stack, end); + var numStart = this.countNeedle(stack, start); + var numEnd = this.countNeedle(stack, end); return numStart > numEnd; } contains(phrase: string, sub: string): boolean { if (sub.length === 0) return true; - const phraseStr = (phrase + this.GqlTokens.NOTHING).toLowerCase(); + var phraseStr = (phrase + this.GqlTokens.NOTHING).toLowerCase(); return phraseStr.indexOf((sub + this.GqlTokens.NOTHING).toLowerCase()) > -1; } @@ -114,7 +114,7 @@ module ngApp.components.gql { } splitField(s: string): IFieldParts { - const xs = s.split(this.GqlTokens.PERIOD); + var xs = s.split(this.GqlTokens.PERIOD); return { docType: xs.shift(), @@ -123,9 +123,9 @@ module ngApp.components.gql { } ajaxRequest(field: string): ng.IPromise { - const parts = this.splitField(field); + var parts = this.splitField(field); - const params = { + var params = { facets: [parts.facet], size: 0, filters: {} diff --git a/app/scripts/components/location/location.services.ts b/app/scripts/components/location/location.services.ts index 3c2f38b5e..739f1677c 100644 --- a/app/scripts/components/location/location.services.ts +++ b/app/scripts/components/location/location.services.ts @@ -86,9 +86,9 @@ module ngApp.components.location.services { filter2query(f: IFilters): string { var q: string[] = _.map(f.content, (ftr: IFilter) => { - const c: IFilterValue = ftr.content; - const o = ftr.op; - const v = ftr.op === "in" ? angular.toJson(c.value) : c.value + var c: IFilterValue = ftr.content; + var o = ftr.op; + var v = ftr.op === "in" ? angular.toJson(c.value) : c.value return [c.field, o, v].join(" "); }); diff --git a/app/scripts/projects/projects.table.model.ts b/app/scripts/projects/projects.table.model.ts index b70110856..bae636493 100644 --- a/app/scripts/projects/projects.table.model.ts +++ b/app/scripts/projects/projects.table.model.ts @@ -1,16 +1,16 @@ module ngApp.projects.models { function withFilter(value: number, filters: Object[], $filter: ng.IFilterService): string { - const filterString = $filter("makeFilter")(filters, true); - const href = 'search/p?filters=' + filterString; - const val = '{{' + value + '|number:0}}'; + var filterString = $filter("makeFilter")(filters, true); + var href = 'search/p?filters=' + filterString; + var val = '{{' + value + '|number:0}}'; return value ? "" + val + '' : '0'; } function getDataType(dataTypes: Object[], dataType:string): number { - const data = _.find(dataTypes, {data_type: dataType}); + var data = _.find(dataTypes, {data_type: dataType}); return data ? data.participant_count : 0; } function dataTypeWithFilters(dataType: string, row: Object[], $filter: ng.IFilterService) { - const fs = [ + var fs = [ {name: 'participants.project.project_id', value: row.project_id}, {name: 'files.data_type', value: dataType} ]; @@ -61,7 +61,7 @@ module ngApp.projects.models { name: "Cases", id: "summary.participant_count", td: (row, $scope) => { - const fs = [{name: 'participants.project.project_id', value: row.project_id}] + var fs = [{name: 'participants.project.project_id', value: row.project_id}] return withFilter(row.summary.participant_count, fs, $scope.$filter); }, sortable: true, @@ -137,7 +137,7 @@ module ngApp.projects.models { name: "Files", id: "summary.file_count", td: (row, $scope) => { - const fs = [{name: 'participants.project.project_id', value: row.project_id}] + var fs = [{name: 'participants.project.project_id', value: row.project_id}] return withFilter(row.summary.file_count, fs, $scope.$filter); }, sortable: true, diff --git a/app/scripts/search/search.files.table.model.ts b/app/scripts/search/search.files.table.model.ts index f7f29c092..068e73b90 100644 --- a/app/scripts/search/search.files.table.model.ts +++ b/app/scripts/search/search.files.table.model.ts @@ -1,15 +1,15 @@ module ngApp.search.models { function withAnnotationFilter(value: number, filters: Object[], $filter: ng.IFilterService): string { - const filterString = $filter("makeFilter")(filters, true); - const href = 'annotations?filters=' + filterString; - const val = '{{' + value + '|number:0}}'; + var filterString = $filter("makeFilter")(filters, true); + var href = 'annotations?filters=' + filterString; + var val = '{{' + value + '|number:0}}'; return "" + val + ''; } function withFilter(value: number, filters: Object[], $filter: ng.IFilterService): string { - const filterString = $filter("makeFilter")(filters, true); - const href = 'search/p?filters=' + filterString; - const val = '{{' + value + '|number:0}}'; + var filterString = $filter("makeFilter")(filters, true); + var href = 'search/p?filters=' + filterString; + var val = '{{' + value + '|number:0}}'; return "" + val + ''; } @@ -28,8 +28,8 @@ module ngApp.search.models { name: "My Projects", id: "my_projects", td: (row, $scope) => { - const isUserProject = $scope.UserService.isUserProject(row); - const icon = isUserProject ? 'check-square-o' : 'square-o'; + var isUserProject = $scope.UserService.isUserProject(row); + var icon = isUserProject ? 'check-square-o' : 'square-o'; return ''; }, inactive: $scope => !$scope.UserService.currentUser, diff --git a/app/scripts/search/search.participants.table.model.ts b/app/scripts/search/search.participants.table.model.ts index cff776052..59daef71c 100644 --- a/app/scripts/search/search.participants.table.model.ts +++ b/app/scripts/search/search.participants.table.model.ts @@ -1,23 +1,23 @@ module ngApp.search.models { function withAnnotationFilter(value: number, filters: Object[], $filter: ng.IFilterService): string { - const filterString = $filter("makeFilter")(filters, true); - const href = 'annotations?filters=' + filterString; - const val = '{{' + value + '|number:0}}'; + var filterString = $filter("makeFilter")(filters, true); + var href = 'annotations?filters=' + filterString; + var val = '{{' + value + '|number:0}}'; return "" + val + ''; } function withFilter(value: number, filters: Object[], $filter: ng.IFilterService): string { - const filterString = $filter("makeFilter")(filters, true); - const href = 'search/f?filters=' + filterString; - const val = '{{' + value + '|number:0}}'; + var filterString = $filter("makeFilter")(filters, true); + var href = 'search/f?filters=' + filterString; + var val = '{{' + value + '|number:0}}'; return value ? "" + val + '' : '0'; } function getDataType(dataTypes: Object[], dataType:string): number { - const data = _.find(dataTypes, {data_type: dataType}); + var data = _.find(dataTypes, {data_type: dataType}); return data ? data.file_count : 0; } function dataTypeWithFilters(dataType: string, row: Object[], $filter: ng.IFilterService) { - const fs = [ + var fs = [ {name: 'participants.participant_id', value: row.participant_id}, {name: 'files.data_type', value: dataType} ]; @@ -37,9 +37,9 @@ module ngApp.search.models { name: "My Projects", id: "my_projects", td: (row, $scope) => { - const fakeFile = {participants: [{project: row.project}]}; - const isUserProject = $scope.UserService.isUserProject(fakeFile); - const icon = isUserProject ? 'check-square-o' : 'square-o'; + var fakeFile = {participants: [{project: row.project}]}; + var isUserProject = $scope.UserService.isUserProject(fakeFile); + var icon = isUserProject ? 'check-square-o' : 'square-o'; return ''; }, inactive: $scope => !$scope.UserService.currentUser @@ -75,8 +75,8 @@ module ngApp.search.models { name: "Files", id: "files", td: (row, $scope) => { - const fs = [{name: 'participants.participant_id', value: row.participant_id}] - const sum = _.sum(_.pluck(row.summary.data_types, 'file_count')) + var fs = [{name: 'participants.participant_id', value: row.participant_id}] + var sum = _.sum(_.pluck(row.summary.data_types, 'file_count')) return withFilter(sum, fs, $scope.$filter); }, tdClassName: 'text-right'