Replaced Array.prototype.unique with a cleaner jQuery equivalent

This commit is contained in:
Jack Walker
2020-07-06 16:24:09 +10:00
parent 9458bd8fc6
commit 4fc300ff87
6 changed files with 30 additions and 31 deletions

View File

@@ -3917,12 +3917,12 @@ beef.browser = {
getPlugins: function () {
var results;
Array.prototype.unique = function () {
var o = {}, i, l = this.length, r = [];
for (i = 0; i < l; i += 1) o[this[i]] = this[i];
for (i in o) r.push(o[i]);
return r;
};
function unique(array) {
return $.grep(array, function(el, index) {
return index === $.inArray(el, array);
});
}
// Things lacking navigator.plugins
if (!navigator.plugins)
@@ -3941,8 +3941,8 @@ beef.browser = {
// Sometimes store the version in description (Real, Adobe)
else results[i] = navigator.plugins[i].name;// + '-desc.' + navigator.plugins[i].description;
}
results = results.unique().toString();
results = unique(results).toString();
// All browsers that don't support navigator.plugins
} else {
results = new Array();