summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/components.html34
1 files changed, 23 insertions, 11 deletions
diff --git a/tests/components.html b/tests/components.html
index 78793ce5..dcd7ac8a 100644
--- a/tests/components.html
+++ b/tests/components.html
@@ -6,13 +6,17 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<link rel="stylesheet" href="../bower_components/bootstrap/dist/css/bootstrap.css" media="screen" id="stylesheet">
- <link rel="stylesheet" href="../assets/css/bootswatch.min.css">
<style>
body {
margin-bottom: 3em;
}
+ #theme {
+ margin-top: 2em;
+ font-size: 4em;
+ }
+
#menu {
z-index: 1040;
position:fixed;
@@ -2903,24 +2907,32 @@
$('.tooltip-test').tooltip();
- $.get("http://api.bootswatch.com/3/", function (data) {
- var menuTemplate = "<div id='menu'><select>{{#.}}<option data-description='{{description}}'>{{name}}</option>{{/.}}</select></div>",
+ $.get("https://bootswatch.aws.af.cm/3/", function (data) {
+ var menuTemplate = "<select id='menu'>{{#.}}<option value='{{name}}' data-description='{{description}}'>{{name}}</option>{{/.}}</select>",
menuHTML = Mustache.render(menuTemplate, data.themes);
$('body').append(menuHTML);
$('#menu').change(function(){
- var $theme = $('#menu :selected'),
- theme = $theme.text(),
- description = $theme.data('description'),
- date = new Date(),
- time = date.getTime()
- url = '../' + theme.toLowerCase() + '/bootstrap.css?' + time;
-
- $('#theme').text(theme);
+ var theme = $('#menu :selected'),
+ text = theme.text(),
+ description = theme.data('description'),
+ time = new Date().getTime()
+ url = '../' + text.toLowerCase() + '/bootstrap.css?' + time;
+
+ $('#theme').text(text);
$('#description').text(description);
$('#stylesheet').attr('href', url);
+
+ localStorage.setItem("theme", text);
+ console.log(localStorage.theme);
});
+
+ if (localStorage.theme) {
+ var theme = localStorage.theme;
+ $("#menu").val(theme).change();
+ console.log(theme);
+ }
}, "json");
</script>