summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorThomas Park <thomas@thomaspark.me>2015-03-27 18:14:20 -0400
committerThomas Park <thomas@thomaspark.me>2015-03-27 18:14:20 -0400
commita0db0b0938689a886e24fee835d2569c7c482251 (patch)
treeb9ef0c07db746d5921d67c755c4595fa2405df08 /tests
parent8a99ce70cb3087864358e082b3dbf109e26c3638 (diff)
update components test to use https and localstorage
Diffstat (limited to 'tests')
-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>