g3debug
HTML
<body>
<h1 id="custom">Stringify Custom Object</h1>
<pre>
</pre>
<h1 id="style">Stringify 1st styleSheet Object</h1>
<script>
var obj1 = new Object();
obj1.a1 = 1; obj1.b1 = 'baz'; obj1.loop1 = obj1; obj1.c1 = true; obj1.d1 = ''; obj1.e1 = [1,2,3];
var obj2 = new Object();
obj2.foo = 'bar'; obj2.loop2 = obj2; obj2.another = obj1;
$('#custom').on('click', function(evt) {
//alert(g3.utils.debug(obj2).toString());
g3.utils.debug(obj2).popup('o');
});
$('#style').on('click', function(evt) {
var s = window.document.styleSheets[0];
//alert(g3.utils.debug(s).toString());
g3.utils.debug(s, 5).popup('o');
});
</script>
CSS
h1 {
color: #808080;
}
h1:hover {
color: #000000;
text-decoration: none;
cursor: pointer;
}
JavaScript
/**
* Root namespace.
* @namespace {g3}
*/
(function(g3, $, window, document, undefined){
/**
* Module 'g3.utils' in root namespace.
* @module {g3.utils}
*/
g3.utils = g3.utils || {};
/*******************************Function typeOf()*******************************
* Overloads javascript's 'typeof()' function.
* @module {g3.utils}
* @function {g3.utils.typeOf}
* @public
* @param {Type} 'value' an identifier of any javascript's type.
* @return {string} Returns a string for the type of the passed argument.
* @refernce http://javascript.crockford.com/remedial.html
* http://stackoverflow.com/questions/767486/how-do-you-check-if-a-variable-is-an-array-in-javascript/767499
*******************************************************************************/
g3.utils.typeOf = function(value) {
var s = typeof value;
if (s === 'object') {
if (value) {
if (Object.prototype.toString.call(value) === Object.prototype.toString.call([])) { //'[object Array]'
s = 'array';
}
} else {
s = 'null';
}
}
return s;
};
/******************************Function htmlList()******************************
* Returns a string of a html list constructed from the passed arguments.
* @module {g3.utils}
* @function {g3.utils.htmlList}
* @public
* @param {String} 'type' the type of list, 'u' for onordered or 'o' for ordered.
* @param {String|Array} Second and forth should be strings or instead it can
* be given an array of strings as a second argument.
* @return {string} Returns a string of a html list constructed from the passed
* arguments starting from the second one or, false if i) there is no second or
* more arguments or, ii), the first argument is not a string with value 'u' or
* 'o'.
* @author Scripto JS Editor by Centurian Comet.
* @copyright All rights reserved.
*******************************************************************************/
...