Set default settings for v4

This commit is contained in:
benweet 2014-08-19 09:17:27 +01:00
parent 143e90cedd
commit 1231b26710
3 changed files with 48 additions and 33 deletions

View File

@ -178,7 +178,7 @@ catch(e) {
window.viewerMode = /(^| )viewer($| )/.test(document.body.className); window.viewerMode = /(^| )viewer($| )/.test(document.body.className);
// Keep the theme in a global variable // Keep the theme in a global variable
window.theme = localStorage.themeV3 || 'default'; window.theme = localStorage.themeV4 || 'default';
var themeModule = "less!themes/" + window.theme; var themeModule = "less!themes/" + window.theme;
if(window.baseDir.indexOf('-min') !== -1) { if(window.baseDir.indexOf('-min') !== -1) {
themeModule = "css!themes/" + window.theme; themeModule = "css!themes/" + window.theme;

View File

@ -21,41 +21,41 @@ define([
dropboxFullAccess: true, dropboxFullAccess: true,
githubFullAccess: true, githubFullAccess: true,
template: [ template: [
'<!DOCTYPE html>\n', '<!DOCTYPE html>',
'<html>\n', '<html>',
'<head>\n', '<head>',
'<meta charset="utf-8">\n', '<meta charset="utf-8">',
'<title><%= documentTitle %></title>\n', '<title><%= documentTitle %></title>',
'<link rel="stylesheet" href="', '<link rel="stylesheet" href="' + constants.MAIN_URL + 'res-min/themes/base.css" />',
constants.MAIN_URL, '<script type="text/javascript" src="' + constants.MAIN_URL + 'libs/MathJax/MathJax.js?config=TeX-AMS_HTML"></script>',
'res-min/themes/base.css" />\n', '</head>',
'<script type="text/javascript" src="', '<body><div class="container"><%= documentHTML %></div></body>',
constants.MAIN_URL,
'libs/MathJax/MathJax.js?config=TeX-AMS_HTML"></script>\n',
'</head>\n',
'<body><div class="container"><%= documentHTML %></div></body>\n',
'</html>' '</html>'
].join(""), ].join('\n'),
pdfTemplate: [ pdfTemplate: [
'<!DOCTYPE html>\n', '<!DOCTYPE html>',
'<html>\n', '<html>',
'<head>\n', '<head>',
'<meta charset="utf-8">\n', '<meta charset="utf-8">',
'<title><%= documentTitle %></title>\n', '<title><%= documentTitle %></title>',
'<link rel="stylesheet" href="', '<link rel="stylesheet" href="http://localhost/res-min/themes/base.css" />',
constants.MAIN_URL, '<script type="text/x-mathjax-config">',
'res-min/themes/base.css" />\n', 'MathJax.Hub.Config({ messageStyle: "none" });',
'<script type="text/x-mathjax-config">\n', '</script>',
'MathJax.Hub.Config({ messageStyle: "none" });\n', '<script type="text/javascript" src="http://localhost/libs/MathJax/MathJax.js?config=TeX-AMS_HTML"></script>',
'</script>\n', '</head>',
'<script type="text/javascript" src="', '<body><%= documentHTML %></body>',
constants.MAIN_URL,
'libs/MathJax/MathJax.js?config=TeX-AMS_HTML"></script>\n',
'</head>\n',
'<body><%= documentHTML %></body>\n',
'</html>' '</html>'
].join(""), ].join('\n'),
pdfOptions: '{}', pdfOptions: [
'{',
' "marginTop": 25,',
' "marginRight": 25,',
' "marginBottom": 25,',
' "marginLeft": 25,',
' "pageSize": "A4"',
'}'
].join('\n'),
sshProxy: constants.SSH_PROXY_URL, sshProxy: constants.SSH_PROXY_URL,
extensionSettings: {} extensionSettings: {}
}; };

View File

@ -239,6 +239,21 @@ define([
version = "v19"; version = "v19";
} }
if(version == 'v19') {
// Force new theme by using themeV4 variable
localStorage.removeItem("themeV3");
// Force welcome tour
localStorage.removeItem("welcomeTour");
if(_.has(localStorage, 'settings')) {
settings = JSON.parse(localStorage.settings);
// Remove PDF settings as it's a new web service
delete settings.pdfTemplate;
delete settings.pdfPageSize;
localStorage.settings = JSON.stringify(settings);
}
version = "v20";
}
localStorage.version = version; localStorage.version = version;
return localStorage; return localStorage;
}); });