Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <style>
- body {
- font-family: verdana;
- font-size: 10pt;
- }
- .folder {
- border: solid 1px silver;
- -moz-border-radius: 5px;
- padding: 0.5em;
- padding-left: 1em;
- margin: 0.5em;
- }
- .folder h3 {
- font-family: verdana;
- font-size: 10pt;
- margin: 0;
- padding: 0;
- }
- </style>
- </head>
- <body>
- <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
- <script type="text/javascript">
- $.fn.buildDivs = function (options) {
- var options = $.extend({
- spaces: 0,
- parentDiv: document.body
- }, options);
- return this.each(function () {
- if (2 == options.spaces) {
- //console.log(new Array(options.spaces*3+1).join(' '), this, this.title, typeof(this.children), this.id);
- }
- if (this.title && typeof(this.children) == 'object') {
- var addDiv = '<div class="folder" id="bm_'+this.id+'"><h3>'+this.title+'</h3></div>';
- $(options.parentDiv).append(addDiv);
- var myDiv = $(options.parentDiv).children('div#bm_'+this.id);
- if (2 == options.spaces) {
- //console.log(myDiv, addDiv);
- //return;
- }
- } else if (this.type == 'text/x-moz-place-separator') {
- var myDiv = $(options.parentDiv).append('<hr>');
- } else {
- var myDiv = $(options.parentDiv).append('<a href="'+this.uri+'">'+this.title+'</a><br>');
- }
- if (typeof(this.children) == 'object') {
- $(this.children).buildDivs({
- spaces: options.spaces+1,
- parentDiv: myDiv
- });
- }
- });
- }
- $(document).ready(function() {
- var data = $.ajax({
- url: 'bookmarks-2009-11-26.json',
- success: function(msg){
- //console.log(msg);
- eval("msg ="+msg);
- $(msg).buildDivs();
- }
- });
- });
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement