Skip to content

Commit

Permalink
Optimized skin changing routine. Added recovery scenario. Fixes #20.
Browse files Browse the repository at this point in the history
- Updated several meta values.
  • Loading branch information
gear54rus committed Apr 14, 2015
1 parent f66c337 commit 33696fe
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 52 deletions.
56 changes: 6 additions & 50 deletions src/content/js/restclient.main.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,62 +182,18 @@ restclient.main = {
},
changeSkin: function (theme) {
this.currentTheme = theme;
$("link").remove();
$('link[href^="css/themes/"]').remove();
$("<link/>", {
rel: "stylesheet",
type: "text/css",
href: "css/themes/" + theme + "/bootstrap.css"
}).appendTo("head");
$("<link/>", {
}).add("<link/>", {
rel: "stylesheet",
type: "text/css",
href: "css/themes/" + theme + "/bootstrap-responsive.css"
}).appendTo("head");
$("<link/>", {
rel: "stylesheet",
type: "text/css",
href: "css/font-awesome.css"
}).appendTo("head");
$("<link/>", {
rel: "stylesheet",
type: "text/css",
href: "css/restclient.css"
}).appendTo("head");
$("<link/>", {
rel: "stylesheet",
type: "text/css",
href: "css/XMLPrettyPrint.css"
}).appendTo("head");
$("<link/>", {
rel: "stylesheet",
type: "text/css",
href: "css/prettify.css"
}).appendTo("head");
$("<link/>", {
rel: "stylesheet",
type: "text/css",
href: "css/KelpJSONView.css"
}).appendTo("head");
$("<link/>", {
rel: "stylesheet",
type: "text/css",
href: "css/bootstrap-tagsinput.css"
}).appendTo("head");
$("<link/>", {
rel: "stylesheet",
type: "text/css",
href: "css/bootstrap-switch.css"
}).appendTo("head");
$("<link/>", {
rel: "stylesheet",
type: "text/css",
href: "css/animate.css"
}).appendTo("head");
$("<link/>", {
rel: "stylesheet",
type: "text/css",
href: "css/restclient.bookmark.css"
}).appendTo("head");
}).on('error', function() {
restclient.main.changeSkin('cerulean');
}).insertBefore($('head > link[rel="stylesheet"]').first());
},
initSkin: function () {
var requestHeaderLayout = restclient.getPref('requestHeaderLayout', 'tag'),
Expand All @@ -262,7 +218,7 @@ restclient.main = {
$('.enable-curl').text('Disable cURL');
}

var defaultTheme = restclient.getPref('defaultSkin', 'simplex');
var defaultTheme = restclient.getPref('defaultSkin', 'cerulean');
restclient.main.changeSkin(defaultTheme);
$('a[data-theme]').click(function () {
restclient.main.changeSkin($(this).attr('data-theme'));
Expand Down
13 changes: 11 additions & 2 deletions src/content/restclient.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,18 @@
<title>RESTClient APS</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="RESTClient, a debugger for RESTful web services." />
<meta name="author" content="Chao ZHOU (chao@zhou.fr)" />
<meta name="description" content="RESTClient APS, a debugger for RESTful web services with APS functionality." />
<meta name="author" content="Paul Gear (gear54rus@gmail.com)" />
<link rel="shortcut icon" href="images/favicon.ico" />
<link href="css/font-awesome.css" type="text/css" rel="stylesheet">
<link href="css/restclient.css" type="text/css" rel="stylesheet">
<link href="css/XMLPrettyPrint.css" type="text/css" rel="stylesheet">
<link href="css/prettify.css" type="text/css" rel="stylesheet">
<link href="css/KelpJSONView.css" type="text/css" rel="stylesheet">
<link href="css/bootstrap-tagsinput.css" type="text/css" rel="stylesheet">
<link href="css/bootstrap-switch.css" type="text/css" rel="stylesheet">
<link href="css/animate.css" type="text/css" rel="stylesheet">
<link href="css/restclient.bookmark.css" type="text/css" rel="stylesheet">
</head>
<body>

Expand Down

0 comments on commit 33696fe

Please # to comment.