From b6b68fa582b1a0087fda3f066a7149978aa96b2e Mon Sep 17 00:00:00 2001 From: "a.m.saafan@gmail.com" Date: Thu, 12 May 2011 09:24:27 +0000 Subject: [PATCH] - Removed all false browser types from being displayed. [Issue #: 305] git-svn-id: https://beef.googlecode.com/svn/trunk@969 b87d56ec-f9c0-11de-8c8a-61c5e9addfc9 --- modules/browser/detect_details/command.js | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/modules/browser/detect_details/command.js b/modules/browser/detect_details/command.js index 06ce9e881..8cb62ae58 100644 --- a/modules/browser/detect_details/command.js +++ b/modules/browser/detect_details/command.js @@ -49,8 +49,19 @@ function serialize(_obj) break; } } - - var browser_type = serialize(beef.browser.type()); - - beef.net.send('<%= @command_url %>', <%= @command_id %>, 'browser_type='+browser_type); + + var data = beef.browser.type(); + + // A function that will get trigered during the conversion to JSON that will remove + // elements with "false" value. + function replacer(key, value) { + if (value == true) + return value; + else if (typeof value == 'object') // Allow the array itself to be iterated. + return value; + else // (value == false) + return; // Do not return anything, to exclude the element from being added. + } + + beef.net.send('<%= @command_url %>', <%= @command_id %>, JSON.stringify(data,replacer)); });