Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge remote branch 'Contra/master'

Conflicts:
	src/docJS.js
  • Loading branch information...
commit 41481eaaca4a57c7a312bf023cb16bf7b768c2af 2 parents 07c2953 + 89175d9
@vladocar authored
Showing with 116 additions and 48 deletions.
  1. +37 −0 src/docJS.js
  2. +79 −48 src/style.css
View
37 src/docJS.js
@@ -1,3 +1,4 @@
+<<<<<<< HEAD
function docJS(d, n) {
var keys = Object.keys(d).sort().reverse();
var i = keys.length;
@@ -35,4 +36,40 @@ function docJS(d, n) {
document.getElementById("a").innerHTML += list;
console.log(x / 1024 + " Kb - It doesn't calculate nested objects");
+=======
+function docJS(obj, name) {
+ var keys = Object.keys(obj).sort().reverse();
+ var prettyPrint = (typeof prettyPrintOne === 'function');
+
+ if (!document.getElementById('sidenav')) {
+ document.getElementsByTagName('body')[0].innerHTML = '<div id="sidenav"></div><ul id="content"></ul>';
+ }
+ var key, val, _i, _len, lines, args, str, out, code, sidenav = '',
+ content = '';
+ for (_i = 0, _len = keys.length; _i < _len; _i++) {
+ key = keys[_i];
+ val = obj[key];
+ out = JSON.stringify(val, null, 4);
+ type = typeof val;
+
+ if (!out) {
+ out = val.toString();
+ }
+
+ code = prettyPrint ? prettyPrintOne(out.replace(/\n/g, '<br/>'), 'js', false) : out;
+ lines = out.split('\n').length;
+ args = (type === 'function') ? val.length : 0;
+
+ sidenav += '<li><a href="#' + name + '.' + key + '">- ' + key + '</a></li>';
+ content += '<li class="name" id="' + name + '.' + key + '"><h3>' + key + ':<i><br/>';
+ content += '(Type: ' + type + ', Lines: ' + lines;
+ if (args > 0) {
+ content += ', Arguments: ' + args;
+ }
+
+ content += ')</i></h3><br><pre>' + code + '</pre></li>';
+ }
+ document.getElementById('sidenav').innerHTML += '<h3 id="namehead">' + name + '</h3><ul id="links">' + sidenav + '<br/></ul>';
+ document.getElementById('content').innerHTML += '<h2>' + name + '</h2>' + content;
+>>>>>>> Contra/master
}
View
127 src/style.css
@@ -1,48 +1,79 @@
-html,body{
- margin:0;padding:0;
-}
-body{background-color: #F4F4F4;}
-a{
- text-decoration: none; color:#333; line-height:1.6;
-}
-a:hover{
- text-decoration: underline;
-}
-i{
- font-size: 12px;
-}
-ul{
- list-style-type: none;
-}
-pre{
-font:14px/ 1.6 Monaco, Consolas, 'Lucida Console', monospace;
-}
-h3{
-
-font-family: "lucida grande","lucida sans unicode", sans-serif;
- display: inline; font-weight: normal;
-}
-/* sidebar is directly taken from backbone.js*/
-#sidebar {
- background: #fff;
- position: fixed;
- top: 0; left: 0; bottom: 0;
- width: 180px;
- overflow-y: auto;
- overflow-x: hidden;
- padding: 15px 0 15px 15px;
- border-right: 1px solid #ddd;
- box-shadow: 0 0 20px #ccc; -webkit-box-shadow: 0 0 20px #ccc; -moz-box-shadow: 0 0 20px #ccc;
- }
- #links{
- list-style-position: inside; padding:15px 0 0 0; margin:0;
-
- }
- #a{
- margin-left:190px;
- }
- .l{
- border-bottom: 1px dotted #ccc;
- padding:15px 0;
-
- }
+{
+ margin:0;
+ padding:0;
+}
+
+body
+{
+ background-color:#F4F4F4;
+}
+
+a
+{
+ text-decoration:none;
+ color:#333;
+ line-height:1.6;
+}
+
+a:hover
+{
+ text-decoration:underline;
+}
+
+i
+{
+ font-size:12px;
+}
+
+ul
+{
+ list-style-type:none;
+}
+
+pre
+{
+ font:14px/ 1.6 Monaco, Consolas, 'Lucida Console', monospace;
+}
+
+h3
+{
+ font-family:"lucida grande","lucida sans unicode", sans-serif;
+ display:inline;
+ font-weight:400;
+}
+
+#sidenav
+{
+ background:#fff;
+ position:fixed;
+ top:0;
+ left:0;
+ bottom:0;
+ width:180px;
+ overflow-y:auto;
+ overflow-x:hidden;
+ border-right:1px solid #ddd;
+ box-shadow:0 0 20px #ccc;
+ -webkit-box-shadow:0 0 20px #ccc;
+ -moz-box-shadow:0 0 20px #ccc;
+ padding:15px 0 15px 15px;
+}
+
+#links
+{
+ list-style-position:inside;
+ margin:0;
+ padding:15px 0 0;
+}
+
+#content
+{
+ margin-left:190px;
+}
+
+.name
+{
+ border-bottom:1px dotted #ccc;
+ padding:15px 0;
+}
Please sign in to comment.
Something went wrong with that request. Please try again.