diff options
author | Thomas Park <thomas@thomaspark.me> | 2012-04-29 12:56:30 -0400 |
---|---|---|
committer | Thomas Park <thomas@thomaspark.me> | 2012-04-29 12:56:30 -0400 |
commit | 3d1c5e53896797b88ceb637052d0e4319f637686 (patch) | |
tree | 963f3dbb0139f517c320b7c76545cf487b326165 | |
parent | 1b8b8aa6c434f06e99c0c78e0563c57b19d66b56 (diff) |
api: new schema and example
-rw-r--r-- | api/example.html | 44 | ||||
-rw-r--r-- | api/themes.json (renamed from themes.json) | 2 |
2 files changed, 45 insertions, 1 deletions
diff --git a/api/example.html b/api/example.html new file mode 100644 index 00000000..c340b23e --- /dev/null +++ b/api/example.html @@ -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 diff --git a/themes.json b/api/themes.json index a82ed3f2..f9e02959 100644 --- a/themes.json +++ b/api/themes.json @@ -103,4 +103,4 @@ ] -}
\ No newline at end of file +} |