make uniqueArray its own function

This commit is contained in:
Stefan Breunig
2013-02-11 16:51:14 +01:00
parent bbdd0ac520
commit 4ecb7c66d7
2 changed files with 7 additions and 3 deletions

View File

@ -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]]);
}
});

View File

@ -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;
});
}