From 4ecb7c66d734f94753c1e42226fcdbd44ced3d90 Mon Sep 17 00:00:00 2001 From: Stefan Breunig Date: Mon, 11 Feb 2013 16:51:14 +0100 Subject: [PATCH] make uniqueArray its own function --- code/map_data.js | 4 +--- code/utils_misc.js | 6 ++++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/code/map_data.js b/code/map_data.js index 06bfef68..5e66196e 100644 --- a/code/map_data.js +++ b/code/map_data.js @@ -121,9 +121,7 @@ window.handleDataResponse = function(data, textStatus, jqXHR) { } if(p2f[portal[0]] !== undefined) { $.merge(p2f[portal[0]], portal[2].portalV2['linkedFields']); - portal[2].portalV2['linkedFields'] = $.grep(p2f[portal[0]], function(v, i) { - return $.inArray(v, p2f[portal[0]]) === i; - }); + portal[2].portalV2['linkedFields'] = uniqueArray(p2f[portal[0]]); } }); diff --git a/code/utils_misc.js b/code/utils_misc.js index 75cd1d72..ef3a02f1 100644 --- a/code/utils_misc.js +++ b/code/utils_misc.js @@ -210,3 +210,9 @@ window.setPermaLink = function(elm) { var qry = 'latE6='+lat+'&lngE6='+lng+'&z=' + map.getZoom(); $(elm).attr('href', 'http://www.ingress.com/intel?' + qry); } + +window.uniqueArray = function(arr) { + return $.grep(arr, function(v, i) { + return $.inArray(v, arr) === i; + }); +}