Upgrade to Bootstrap 3
This commit is contained in:
parent
32f3237463
commit
5d06c75e23
14
index.html
14
index.html
@ -12,23 +12,17 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="msvalidate.01" content="5E47EE6F67B069C17E3CDD418351A612" />
|
||||
<script>
|
||||
// Use http://.../?debug to serve original CSS/JavaScript files instead of minified
|
||||
var suffix = "";
|
||||
// Use http://.../?debug to serve original JavaScript files instead of minified
|
||||
var mainModule = "main";
|
||||
if(!location.search.match(/(\?|&)debug/)) {
|
||||
suffix = "-min";
|
||||
}
|
||||
//document.write('<link href="css/main' + suffix + '.css" rel="stylesheet">');
|
||||
var theme = localStorage.theme;
|
||||
if(theme) {
|
||||
//document.write('<link href="themes/' + theme + '/' + theme + '.css" rel="stylesheet">');
|
||||
mainModule += "-min";
|
||||
}
|
||||
var require = {
|
||||
baseUrl: "js",
|
||||
deps: [
|
||||
"main" + suffix
|
||||
mainModule
|
||||
]
|
||||
};
|
||||
var viewerMode = false;
|
||||
</script>
|
||||
<script src="js/libs/require.js"></script>
|
||||
</head>
|
||||
|
21
js/core.js
21
js/core.js
@ -105,7 +105,7 @@ define([
|
||||
// Layout orientation
|
||||
utils.setInputRadio("radio-layout-orientation", settings.layoutOrientation);
|
||||
// Theme
|
||||
utils.setInputValue($themeInputElt, localStorage.theme || 'default');
|
||||
utils.setInputValue($themeInputElt, theme);
|
||||
$themeInputElt.change();
|
||||
// Lazy rendering
|
||||
utils.setInputChecked("#input-settings-lazy-rendering", settings.lazyRendering);
|
||||
@ -188,9 +188,6 @@ define([
|
||||
|
||||
// Create the layout
|
||||
function createLayout() {
|
||||
if(viewerMode === true) {
|
||||
return;
|
||||
}
|
||||
var layoutGlobalConfig = {
|
||||
closable: true,
|
||||
resizable: false,
|
||||
@ -549,12 +546,6 @@ define([
|
||||
// Other initialization that are not prioritary
|
||||
eventMgr.addListener("onReady", function() {
|
||||
|
||||
// Load theme list
|
||||
var themeOptions = _.reduce(THEME_LIST, function(themeOptions, name, value) {
|
||||
return themeOptions + '<option value="' + value + '">' + name + '</option>';
|
||||
}, '');
|
||||
document.getElementById('input-settings-theme').innerHTML = themeOptions;
|
||||
|
||||
var isModalShown = false;
|
||||
$('.modal').on('show.bs.modal', function() {
|
||||
// Close panel if open
|
||||
@ -618,7 +609,7 @@ define([
|
||||
});
|
||||
|
||||
// Hot theme switcher in the settings
|
||||
var currentTheme = localStorage.theme || 'default';
|
||||
var currentTheme = theme;
|
||||
function applyTheme(theme) {
|
||||
theme = theme || 'default';
|
||||
if(currentTheme != theme) {
|
||||
@ -736,6 +727,14 @@ define([
|
||||
e.stopPropagation();
|
||||
});
|
||||
|
||||
if (viewerMode === false) {
|
||||
// Load theme list
|
||||
var themeOptions = _.reduce(THEME_LIST, function(themeOptions, name, value) {
|
||||
return themeOptions + '<option value="' + value + '">' + name + '</option>';
|
||||
}, '');
|
||||
document.getElementById('input-settings-theme').innerHTML = themeOptions;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
return core;
|
||||
|
@ -45,26 +45,31 @@ define([
|
||||
// Configure extensions
|
||||
extensionSettings = settings.extensionSettings || {};
|
||||
_.each(extensionList, function(extension) {
|
||||
// Set the extension.config attribute from settings or default configuration
|
||||
// Set the extension.config attribute from settings or default
|
||||
// configuration
|
||||
extension.config = _.extend({}, extension.defaultConfig, extensionSettings[extension.extensionId]);
|
||||
if(viewerMode === true && extension.disableInViewer === true) {
|
||||
// Skip enabling the extension if we are in the viewer and extension doesn't support it
|
||||
// Skip enabling the extension if we are in the viewer and extension
|
||||
// doesn't support it
|
||||
extension.enabled = false;
|
||||
}
|
||||
else {
|
||||
// Enable the extension if it's not optional or it has not been disabled by the user
|
||||
extension.enabled = !extension.isOptional || extension.config.enabled === undefined || extension.config.enabled === true;
|
||||
// Enable the extension if it's not optional or it has not been
|
||||
// disabled by the user
|
||||
extension.enabled = !extension.isOptional || extension.config.enabled === undefined || extension.config.enabled === true;
|
||||
}
|
||||
});
|
||||
|
||||
// Returns all listeners with the specified name that are implemented in the enabled extensions
|
||||
|
||||
// Returns all listeners with the specified name that are implemented in the
|
||||
// enabled extensions
|
||||
function getExtensionListenerList(eventName) {
|
||||
return _.chain(extensionList).map(function(extension) {
|
||||
return extension.enabled && extension[eventName];
|
||||
}).compact().value();
|
||||
}
|
||||
|
||||
// Returns a function that calls every listeners with the specified name from all enabled extensions
|
||||
// Returns a function that calls every listeners with the specified name
|
||||
// from all enabled extensions
|
||||
var eventListenerListMap = {};
|
||||
function createEventHook(eventName) {
|
||||
eventListenerListMap[eventName] = getExtensionListenerList(eventName);
|
||||
@ -77,12 +82,12 @@ define([
|
||||
listener.apply(null, eventArguments);
|
||||
}
|
||||
catch(e) {
|
||||
console.error(e);
|
||||
console.error(_.isObject(e) ? e.stack : e);
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
// Add a Hook to the eventMgr that we can fire using eventMgr.eventName()
|
||||
function addEventHook(eventName) {
|
||||
eventMgr[eventName] = createEventHook(eventName);
|
||||
@ -92,7 +97,8 @@ define([
|
||||
eventMgr.addListener = function(eventName, listener) {
|
||||
try {
|
||||
eventListenerListMap[eventName].push(listener);
|
||||
} catch(e) {
|
||||
}
|
||||
catch(e) {
|
||||
console.error('No event listener called ' + eventName);
|
||||
}
|
||||
};
|
||||
@ -141,7 +147,7 @@ define([
|
||||
addEventHook("onFileClosed");
|
||||
addEventHook("onContentChanged");
|
||||
addEventHook("onTitleChanged");
|
||||
|
||||
|
||||
// Operations on folders
|
||||
addEventHook("onFoldersChanged");
|
||||
|
||||
@ -200,7 +206,7 @@ define([
|
||||
eventMgr["onReady"] = function() {
|
||||
previewContentsElt = document.getElementById('preview-contents');
|
||||
previewContentsJQElt = $(previewContentsElt);
|
||||
|
||||
|
||||
if(viewerMode === false) {
|
||||
// Create accordion in settings dialog
|
||||
var accordionHtml = _.chain(extensionList).sortBy(function(extension) {
|
||||
@ -211,10 +217,10 @@ define([
|
||||
extensionName: extension.extensionName,
|
||||
isOptional: extension.isOptional,
|
||||
settingsBlock: extension.settingsBlock
|
||||
}): "");
|
||||
}) : "");
|
||||
}, "").value();
|
||||
document.querySelector('.accordion-extensions').innerHTML = accordionHtml;
|
||||
|
||||
|
||||
// Create a button from an extension listener
|
||||
function createBtn(listener) {
|
||||
var buttonGrpElt = crel('div', {
|
||||
@ -248,7 +254,7 @@ define([
|
||||
});
|
||||
var previewButtonsElt = document.querySelector('.extension-preview-buttons');
|
||||
previewButtonsElt.appendChild(extensionPreviewButtonsFragment);
|
||||
|
||||
|
||||
// A bit of jQuery...
|
||||
previewButtonsElt = $(previewButtonsElt);
|
||||
var previewButtonsWidth = previewButtonsElt.width();
|
||||
@ -259,7 +265,7 @@ define([
|
||||
right: -previewButtonsWidth + btnGroupElt.width() + btnGroupElt.position().left
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
// Call onReady listeners
|
||||
|
@ -5,7 +5,7 @@ define([
|
||||
"text!html/dialogManagePublicationLocation.html",
|
||||
], function($, _, Extension, dialogManagePublicationLocationHTML) {
|
||||
|
||||
var dialogManagePublication = new Extension("dialogManagePublication", 'Dialog "Manage publication"');
|
||||
var dialogManagePublication = new Extension("dialogManagePublication", 'Dialog "Manage publication"', false, true);
|
||||
|
||||
var eventMgr = undefined;
|
||||
dialogManagePublication.onEventMgrCreated = function(eventMgrParameter) {
|
||||
|
@ -5,7 +5,7 @@ define([
|
||||
"text!html/dialogManageSynchronizationLocation.html",
|
||||
], function($, _, Extension, dialogManageSynchronizationLocationHTML) {
|
||||
|
||||
var dialogManageSynchronization = new Extension("dialogManageSynchronization", 'Dialog "Manage synchronization"');
|
||||
var dialogManageSynchronization = new Extension("dialogManageSynchronization", 'Dialog "Manage synchronization"', false, true);
|
||||
|
||||
var eventMgr = undefined;
|
||||
dialogManageSynchronization.onEventMgrCreated = function(eventMgrParameter) {
|
||||
|
@ -9,7 +9,7 @@ define([
|
||||
"text!html/documentSelectorSettingsBlock.html",
|
||||
], function($, _, crel, utils, Extension, mousetrap, fileSystem, documentSelectorSettingsBlockHTML) {
|
||||
|
||||
var documentSelector = new Extension("documentSelector", 'Document Selector');
|
||||
var documentSelector = new Extension("documentSelector", 'Document Selector', true, true);
|
||||
documentSelector.settingsBlock = documentSelectorSettingsBlockHTML;
|
||||
documentSelector.defaultConfig = {
|
||||
orderBy: "title",
|
||||
|
@ -1,8 +1,9 @@
|
||||
|
||||
<div class="navbar navbar-fixed-top ui-layout-north">
|
||||
<div class="navbar-inner">
|
||||
<div class="nav right-space pull-right"></div>
|
||||
|
||||
<ul class="nav pull-right hide">
|
||||
<ul class="nav pull-right">
|
||||
<li class="btn-group">
|
||||
<button class="btn btn-default action-edit-document hide"
|
||||
title="Edit this document">
|
||||
@ -10,63 +11,80 @@
|
||||
</button>
|
||||
</li>
|
||||
<li class="btn-group">
|
||||
<button class="btn btn-default dropdown-toggle" data-toggle="dropdown"
|
||||
title="Save this document">
|
||||
<i class="icon-download-alt"></i>
|
||||
<button class="btn btn-default dropdown-toggle"
|
||||
data-toggle="dropdown" title="Save this document">
|
||||
<i class="icon-download"></i>
|
||||
</button>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a class="action-download-md" href="#"><i
|
||||
class="icon-download-alt"></i> Save as Markdown</a></li>
|
||||
class="icon-download"></i> Save as Markdown</a></li>
|
||||
<li><a class="action-download-html" href="#"><i
|
||||
class="icon-download-alt"></i> Save as HTML</a></li>
|
||||
class="icon-download"></i> Save as HTML</a></li>
|
||||
<li><a class="action-download-template" href="#"><i
|
||||
class="icon-download-alt"></i> Save using template</a></li>
|
||||
class="icon-download"></i> Save using template</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="btn-group">
|
||||
<button class="btn btn-default dropdown-toggle action-open-file"
|
||||
data-toggle="dropdown" title="Open local document">
|
||||
<i class="icon-folder-open"></i>
|
||||
</button>
|
||||
<ul id="file-selector" class="dropdown-menu">
|
||||
<li class="stick">
|
||||
<div class="input-prepend">
|
||||
<span class="add-on"><i class="icon-search"></i></span><input
|
||||
type="text" id="file-search" class="span3">
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="btn-group"><button class="btn btn-default action-open-stackedit"
|
||||
title="Open StackEdit">
|
||||
<i class="icon-provider-stackedit"></i>
|
||||
</button></li>
|
||||
</ul>
|
||||
<ul class="nav pull-right">
|
||||
<li><span class="file-title-navbar"></span></li>
|
||||
</ul>
|
||||
<ul class="nav pull-right">
|
||||
<li><i class="working-indicator icon-none"></i></li>
|
||||
<li><span class="brand file-title-navbar"></span></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div id="wmd-button-bar" class="hide"></div>
|
||||
<textarea id="wmd-input" class="hide"></textarea>
|
||||
<div class="preview-container">
|
||||
<div id="preview-contents">
|
||||
<div id="wmd-preview" class="preview-content"></div>
|
||||
<div class="ui-layout-center preview-container"></div>
|
||||
|
||||
<div class="menu-panel collapse width">
|
||||
<button class="btn btn-success collapse-button action-open-stackedit" title="Open StackEdit">
|
||||
<i class="icon-left-dir"></i> <img src="img/stackedit-64.png"
|
||||
width="32" height="32" />
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="document-panel collapse width">
|
||||
<button class="btn btn-success collapse-button" data-toggle="collapse"
|
||||
data-target=".document-panel" title="Select document">
|
||||
<i class="icon-folder-open"></i> <i class="icon-right-dir"></i>
|
||||
</button>
|
||||
<div class="search-bar clearfix">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon"><i class="icon-search"></i></span><input
|
||||
type="text" class="form-control"></input>
|
||||
<button type="button" class="close" title="clear">×</button>
|
||||
<div class="input-group-btn">
|
||||
<a data-toggle="modal" data-target=".modal-document-manager"
|
||||
class="btn btn-link" title="Manage documents"><i
|
||||
class="icon-layers"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel-content">
|
||||
<div class="list-group document-list"></div>
|
||||
<div class="list-group document-list-filtered hide"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal modal-non-unique">
|
||||
<div class="modal-header">
|
||||
<h3>Ooops...</h3>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p>StackEdit has stopped because another instance was running in
|
||||
the same browser.</p>
|
||||
<blockquote class="muted">If you want to reopen
|
||||
StackEdit, click on "Reload".</blockquote>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<a href="javascript:window.location.reload();" class="btn btn-primary">Reload</a>
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
|
||||
<div class="modal-header">
|
||||
<h3 class="modal-title">Ooops...</h3>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p>StackEdit has stopped because another instance was running in
|
||||
the same browser.</p>
|
||||
<blockquote class="muted">If you want to reopen
|
||||
StackEdit, click on "Reload".</blockquote>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<a href="javascript:window.location.reload();"
|
||||
class="btn btn-primary">Reload</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -84,6 +84,7 @@ if(location.search.match(/(\?|&)console/)) {
|
||||
logger = console;
|
||||
}
|
||||
|
||||
var viewerMode = /(^| )viewer($| )/.test(document.body.className);
|
||||
var theme = localStorage.theme || 'default';
|
||||
|
||||
// RequireJS entry point. By requiring synchronizer, publisher and
|
||||
|
@ -231,25 +231,28 @@ define([
|
||||
'</li>'
|
||||
].join('');
|
||||
eventMgr.addListener("onReady", function() {
|
||||
// Add every provider in the panel menu
|
||||
var publishMenuElt = document.querySelector('.menu-panel .collapse-publish-on .nav');
|
||||
var publishMenuHtml = _.reduce(providerMap, function(result, provider) {
|
||||
return result + _.template(initPublishButtonTmpl, {
|
||||
provider: provider
|
||||
if(viewerMode === false) {
|
||||
// Add every provider in the panel menu
|
||||
var publishMenuElt = document.querySelector('.menu-panel .collapse-publish-on .nav');
|
||||
var publishMenuHtml = _.reduce(providerMap, function(result, provider) {
|
||||
return result + _.template(initPublishButtonTmpl, {
|
||||
provider: provider
|
||||
});
|
||||
}, '');
|
||||
publishMenuElt.innerHTML = publishMenuHtml;
|
||||
_.each(providerMap, function(provider) {
|
||||
// Click on open publish dialog
|
||||
$(publishMenuElt.querySelector('.action-init-publish-' + provider.providerId)).click(function() {
|
||||
initNewLocation(provider);
|
||||
});
|
||||
// Click on perform new publication
|
||||
$(".action-publish-" + provider.providerId).click(function() {
|
||||
initNewLocation(provider);
|
||||
});
|
||||
});
|
||||
}, '');
|
||||
publishMenuElt.innerHTML = publishMenuHtml;
|
||||
_.each(providerMap, function(provider) {
|
||||
// Click on open publish dialog
|
||||
$(publishMenuElt.querySelector('.action-init-publish-' + provider.providerId)).click(function() {
|
||||
initNewLocation(provider);
|
||||
});
|
||||
// Click on perform new publication
|
||||
$(".action-publish-" + provider.providerId).click(function() {
|
||||
initNewLocation(provider);
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
$(".action-process-publish").click(performNewLocation);
|
||||
|
||||
// Save As menu items
|
||||
|
@ -1,3 +1,3 @@
|
||||
@import "main.less"
|
||||
|
||||
@primary-bg: #d7dee3;
|
||||
@primary-bg: #d5dde3;
|
||||
|
@ -225,11 +225,11 @@ body {
|
||||
padding: 0;
|
||||
.left-space {
|
||||
width: 30px;
|
||||
height: 38px;
|
||||
height: @input-height-base;
|
||||
}
|
||||
.right-space {
|
||||
width: 20px;
|
||||
height: 38px;
|
||||
height: @input-height-base;
|
||||
}
|
||||
.nav {
|
||||
float: left;
|
||||
@ -299,6 +299,7 @@ body {
|
||||
.menu-panel, .document-panel {
|
||||
display: block;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
height: 100%;
|
||||
z-index: 10;
|
||||
overflow: initial;
|
||||
@ -480,7 +481,7 @@ body {
|
||||
input {
|
||||
cursor: pointer;
|
||||
margin: 0 16px;
|
||||
height: 38px;
|
||||
height: @input-height-base;
|
||||
}
|
||||
}
|
||||
.input-rename {
|
||||
@ -1076,21 +1077,19 @@ div.jGrowl {
|
||||
*******************/
|
||||
|
||||
.viewer {
|
||||
#navbar {
|
||||
position: fixed;
|
||||
}
|
||||
|
||||
.navbar-inner {
|
||||
background-color: rgba(215, 215, 215, 0.75) !important;
|
||||
.file-title-navbar {
|
||||
line-height: @input-height-base;
|
||||
}
|
||||
|
||||
#preview-contents {
|
||||
max-width: 1024px;
|
||||
margin: 50px auto;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.btn-group {
|
||||
margin-right: 0;
|
||||
margin-left: 0;
|
||||
|
||||
.document-panel .search-bar {
|
||||
padding: 20px 20px 10px;
|
||||
.input-group-btn {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
14
viewer.html
14
viewer.html
@ -13,23 +13,17 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="msvalidate.01" content="5E47EE6F67B069C17E3CDD418351A612" />
|
||||
<script>
|
||||
// Use http://.../?debug to serve original CSS/JavaScript files instead of minified
|
||||
var suffix = "";
|
||||
// Use http://.../?debug to serve original JavaScript files instead of minified
|
||||
var mainModule = "main";
|
||||
if(!location.search.match(/(\?|&)debug/)) {
|
||||
suffix = "-min";
|
||||
}
|
||||
document.write('<link href="css/main' + suffix + '.css" rel="stylesheet">');
|
||||
var theme = localStorage.theme;
|
||||
if(theme) {
|
||||
document.write('<link href="themes/' + theme + '/' + theme + '.css" rel="stylesheet">');
|
||||
mainModule += "-min";
|
||||
}
|
||||
var require = {
|
||||
baseUrl: "js",
|
||||
deps: [
|
||||
"main" + suffix
|
||||
mainModule
|
||||
]
|
||||
};
|
||||
var viewerMode = true;
|
||||
</script>
|
||||
<script src="js/libs/require.js"></script>
|
||||
</head>
|
||||
|
Loading…
Reference in New Issue
Block a user