if (typeof(PhpDebugBar) == 'undefined') { // namespace var PhpDebugBar = {}; } /** * @namespace */ PhpDebugBar.Widgets = (function($) { var widgets = {}; /** * Replaces spaces with   and line breaks with
* * @param {String} text * @return {String} */ var htmlize = function(text) { return text.replace(/\n/g, '
').replace(/\s/g, " ") }; widgets.htmlize = htmlize; /** * Returns a string representation of value, using JSON.stringify * if it's an object. * * @param {Object} value * @param {Boolean} prettify Uses htmlize() if true * @return {String} */ var renderValue = function(value, prettify) { if (typeof(value) !== 'string') { if (prettify) { return htmlize(JSON.stringify(value, undefined, 2)); } return JSON.stringify(value); } return value; }; widgets.renderValue = renderValue; // ------------------------------------------------------------------ // Generic widgets // ------------------------------------------------------------------ /** * Displays array element in a