api: new schema and example
authorThomas Park <thomas@thomaspark.me>
Sun, 29 Apr 2012 16:56:30 +0000 (12:56 -0400)
committerThomas Park <thomas@thomaspark.me>
Sun, 29 Apr 2012 16:56:30 +0000 (12:56 -0400)
api/example.html [new file with mode: 0644]
api/themes.json [moved from themes.json with 99% similarity]

diff --git a/api/example.html b/api/example.html
new file mode 100644 (file)
index 0000000..c340b23
--- /dev/null
@@ -0,0 +1,44 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+       <meta charset="utf-8">
+       <title>Bootswatch API Example</title>
+       <style type="text/css">
+               .hidden { display: none; }
+       </style>
+</head>
+
+<body>
+
+       <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
+       <script src="http://github.com/janl/mustache.js/raw/master/mustache.js"></script>
+       <script type="text/javascript">
+       
+       $(document).ready(function(){
+       
+               $.get("http://simplejsonp.nodester.com/thomaspark/bootswatch", function (data) {
+                       
+                                       var template_menu = "<div id='menu'><select>{{#.}}<option>{{name}}</option>{{/.}}</select></div>";
+                                       var template_previews = "{{#.}}<div class='preview hidden' id='{{name}}'><h1>{{name}}: {{description}}</h1><p><a href='{{preview}}'><img src='{{thumbnail}}'></a></p></div>{{/.}}"
+                                       
+                                       var output_menu = Mustache.render(template_menu, data.themes);
+                                       var output_previews = Mustache.render(template_previews, data.themes);                                  
+
+                                       $('body').append(output_menu + output_previews);
+                                       
+                                       $('.preview').first().removeClass('hidden');
+                                                                       
+                                       $('#menu').change(function(){
+                                               $('.preview').addClass('hidden');
+                                               var show = '#' + $('#menu :selected').text();
+                                               $(show).removeClass('hidden');
+                                       });
+                       
+                       }, "json");
+                               
+       });
+                               
+       </script>
+
+</body>
+</html>
\ No newline at end of file
similarity index 99%
rename from themes.json
rename to api/themes.json
index a82ed3f..f9e0295 100644 (file)
        
        ]
 
-}
\ No newline at end of file
+}