Upgrade to Bootstrap 3

This commit is contained in:
benweet 2013-08-04 01:53:46 +01:00
parent 04d78335c0
commit 42ee231e8e
30 changed files with 11651 additions and 14866 deletions

7452
css/bootstrap.css vendored

File diff suppressed because it is too large Load Diff

View File

@ -101,6 +101,10 @@ input::-webkit-input-placeholder,textarea::-webkit-input-placeholder {
rgba(255, 134, 97, 0.6) !important;
}
.nav > li {
display: inline-block;
}
.navbar-inner .btn,
#extension-preview-buttons .btn {
background-color: #ddd;
@ -125,8 +129,8 @@ input::-webkit-input-placeholder,textarea::-webkit-input-placeholder {
.nav .dropdown-toggle .caret,
.nav .dropdown-toggle:hover .caret,
.nav .dropdown-toggle:focus .caret {
border-top-color: #000;
border-bottom-color: #000;
border-top-color: #525252;
border-bottom-color: #525252;
}
.navbar .nav.hide {
@ -142,6 +146,68 @@ input::-webkit-input-placeholder,textarea::-webkit-input-placeholder {
filter: alpha(opacity = 30);
}
.navbar .pull-right > li > .dropdown-menu, .navbar .nav > li > .dropdown-menu.pull-right {
right: 0;
left: auto;
}
.navbar .pull-right > li > .dropdown-menu .dropdown-menu,
.navbar .nav > li > .dropdown-menu.pull-right .dropdown-menu {
right: 100%;
left: auto;
margin-right: -1px;
margin-left: 0;
}
.dropdown-submenu {
position: relative;
}
.dropdown-submenu > .dropdown-menu {
top: 0;
left: 100%;
margin-top: -6px;
margin-left: -1px;
}
.dropdown-submenu:hover > .dropdown-menu {
display: block;
}
.dropup .dropdown-submenu > .dropdown-menu {
top: auto;
bottom: 0;
margin-top: 0;
margin-bottom: -2px;
}
.dropdown-submenu > a:after {
display: block;
float: right;
width: 0;
height: 0;
margin-top: 5px;
margin-right: -10px;
border-color: transparent;
border-left-color: #cccccc;
border-style: solid;
border-width: 5px 0 5px 5px;
content: " ";
}
.dropdown-submenu:hover > a:after {
border-left-color: #ffffff;
}
.dropdown-submenu.pull-left {
float: none;
}
.dropdown-submenu.pull-left > .dropdown-menu {
left: -100%;
margin-left: 10px;
}
.dropdown-menu>li>a:hover,
.dropdown-menu>li>a:focus,
.dropdown-submenu:hover>a,
@ -216,7 +282,7 @@ input[readonly],select[readonly],textarea[readonly] {
}
#extension-buttons>.btn-group {
margin: 5px 0 0;
margin: 0;
}
#extension-preview-buttons>.btn-group {
@ -278,10 +344,6 @@ input[readonly],select[readonly],textarea[readonly] {
padding-left: 12px;
}
.navbar-inner {
background-color: #ddd !important;
}
code {
color: #333333;
}
@ -319,8 +381,13 @@ hr {
}
#file-title {
line-height: 23px;
padding: 9px 15px 11px;
padding: 4px 15px;
display: block;
float: left;
margin-left: -20px;
font-size: 20px;
font-weight: 200;
color: #666;
}
#file-title i {
@ -331,15 +398,26 @@ hr {
margin-right: 5px;
}
#navbar {
.navbar {
background-color: #ddd;
position: static;
}
#menu-bar {
margin: 0 15px 10px 15px;
.navbar .nav {
float: left;
margin: 6px 0 0;
}
#wmd-button-bar {
.navbar .nav.pull-right {
float: right;
}
.navbar .pull-right > li > .dropdown-menu {
right: 0;
left: auto;
}
#menu-bar {
margin-left: 15px;
}
@ -353,13 +431,16 @@ hr {
}
.wmd-button-row {
margin: 10px 0;
height: 20px;
padding: 0;
margin-left: 10px;
}
.wmd-spacer {
margin-right: 15px;
display: inline-block;
display: none;
}
.wmd-spacer + .wmd-button {
margin-left: 20px;
}
.wmd-prompt-background {
@ -439,29 +520,12 @@ div.dropdown-menu textarea {
font-size: 0.8em;
}
.icon-link {
background-position: -72px -168px;
}
.icon-code {
width: 15px;
background-position: -384px -168px;
}
.icon-stat {
background-position: -1px -168px;
}
.icon-numbered-list {
background-position: -408px -168px;
}
.icon-hr {
background-position: -432px -168px;
}
.icon-undo {
background-position: -456px -168px;
[class^="icon-"], [class*=" icon-"] {
color: #525252;
display: inline-block;
line-height: 14px;
vertical-align: middle;
background-repeat: no-repeat;
}
.icon-stackedit {
@ -537,7 +601,7 @@ div.dropdown-menu textarea {
width: 43px;
height: 11px;
background-position: 0 0;
margin: 16px 16px 0;
margin: 0 20px 12px;
}
.working-indicator.show {

View File

@ -1,4 +1,5 @@
@import url("bootstrap.css");
@import url("fontello.css");
@import url("jgrowl.css");
@import url("prettify.css");
@import url("highlight.css");

View File

@ -17,10 +17,10 @@
if(!location.search.match(/(\?|&)debug/)) {
suffix = "-min";
}
document.write('<link href="css/main' + suffix + '.css" rel="stylesheet">');
//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">');
//document.write('<link href="themes/' + theme + '/' + theme + '.css" rel="stylesheet">');
}
var require = {
baseUrl: "js",
@ -33,791 +33,6 @@
<script src="js/libs/require.js"></script>
</head>
<body>
<div class="navbar navbar-fixed-top ui-layout-north">
<div class="navbar-inner">
<ul class="nav">
<li><div id="wmd-button-bar"></div></li>
</ul>
<ul class="nav pull-right hide" id="menu-bar">
<li id="extension-buttons"></li>
<li class="btn-group"><button class="btn action-create-file"
title="New local document">
<i class="icon-file"></i>
</button>
<button class="btn" title="Delete local document"
data-toggle="modal" data-target="#modal-remove-file-confirm">
<i class="icon-trash"></i>
</button>
<button class="btn 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 dropdown-toggle"
data-toggle="dropdown" title="Menu">
<i class="icon-stackedit"></i>&nbsp;&nbsp;<b class="caret"></b>
</button>
<ul class="dropdown-menu">
<li><a href="viewer.html" title="StackEdit Viewer"><i
class="icon-fullscreen"></i> StackEdit Viewer</a></li>
<li class="dropdown-submenu"><a href="#"><i
class="icon-hdd"></i> Open from...</a>
<ul class="dropdown-menu">
<li><a data-toggle="modal"
data-target="#modal-import-harddrive-markdown"
class="action-reset-input" href="#">Import from hard drive</a></li>
<li><a data-toggle="modal"
data-target="#modal-import-harddrive-html"
class="action-reset-input" href="#">Convert HTML to
Markdown</a></li>
</ul></li>
<li class="dropdown-submenu"><a href="#"><i
class="icon-hdd"></i> Save as...</a>
<ul class="dropdown-menu">
<li><a class="action-download-md" href="#">Save as
Markdown</a></li>
<li><a class="action-download-html" href="#">Save as
HTML</a></li>
<li><a class="action-download-template" href="#">Save
using template</a></li>
</ul></li>
<li class="divider with-text">synchronize</li>
<li class="dropdown-submenu"><a href="#"><i
class="icon-gdrive"></i> Google Drive</a>
<ul class="dropdown-menu">
<li><a href="#" class="action-sync-import-gdrive">Import
from Google Drive</a></li>
<li><a href="#" class="action-sync-export-dialog-gdrive">Export
to Google Drive</a></li>
</ul></li>
<li class="dropdown-submenu"><a href="#"><i
class="icon-dropbox"></i> Dropbox</a>
<ul class="dropdown-menu">
<li><a class="action-sync-import-dropbox" href="#">Import
from Dropbox</a></li>
<li><a href="#" class="action-sync-export-dialog-dropbox">Export
to Dropbox</a></li>
</ul></li>
<li><a href="#" data-toggle="modal"
data-target="#modal-manage-sync" class="action-reset-input"><i
class="icon-refresh"></i> Manage synchronization</a></li>
<li class="divider with-text">publish</li>
<li class="dropdown-submenu"><a href="#"><i
class="icon-share"></i> Publish on</a>
<ul id="publish-menu" class="dropdown-menu">
</ul></li>
<li><a href="#" data-toggle="modal"
data-target="#modal-manage-publish" class="action-reset-input"><i
class="icon-share"></i> Manage publication</a></li>
<li class="divider"></li>
<li><a href="#" data-toggle="modal"
data-target="#modal-settings" class="action-load-settings"><i
class="icon-cog"></i> Settings</a></li>
<li><a href="#" data-toggle="modal"
data-target="#modal-about"><i class="icon-question-sign"></i>
About</a></li>
</ul></li>
</ul>
<ul class="nav pull-right">
<li><i class="working-indicator icon-none"></i></li>
<li><a class="brand" id="file-title" href="#"
title="Rename current document"> </a></li>
<li class="navbar-form"><input id="file-title-input"
type="text" class="span3 hide" placeholder="Document title" /></li>
</ul>
</div>
</div>
<textarea id="wmd-input" class="ui-layout-center hide"></textarea>
<div class="ui-layout-east preview-container hide"></div>
<div class="ui-layout-south preview-container hide"></div>
<div id="modal-insert-link" class="modal hide">
<div class="modal-header">
<button type="button" class="close action-close-insert-link"
data-dismiss="modal" aria-hidden="true">&times;</button>
<h3>Hyperlink</h3>
</div>
<div class="modal-body">
<p>Please provide the link URL and an optional title:</p>
<div class="input-prepend">
<span class="add-on"><i class="icon-globe"></i></span><input
id="input-insert-link" type="text" class="span5"
placeholder='http://example.com/ "optional title"'></input>
</div>
</div>
<div class="modal-footer">
<a href="#" class="btn" data-dismiss="modal">Cancel</a> <a href="#"
class="btn btn-primary action-insert-link" data-dismiss="modal">OK</a>
</div>
</div>
<div id="modal-insert-image" class="modal hide">
<div class="modal-header">
<button type="button" class="close action-close-insert-link"
data-dismiss="modal" aria-hidden="true">&times;</button>
<h3>Image</h3>
</div>
<div class="modal-body">
<p>Please provide the image URL and an optional title:</p>
<div class="input-prepend">
<span class="add-on"><i class="icon-picture"></i></span><input
id="input-insert-image" type="text" class="span5"
placeholder='http://example.com/image.jpg "optional title"'></input>
</div>
</div>
<div class="modal-footer">
<a href="#" class="btn action-import-image-gplus"
data-dismiss="modal"><i class="icon-gplus"></i> Import from
Google+</a> <a href="#" class="btn" data-dismiss="modal">Cancel</a> <a
href="#" class="btn btn-primary action-insert-image"
data-dismiss="modal">OK</a>
</div>
</div>
<div id="modal-import-image" class="modal hide">
<div class="modal-header">
<button type="button" class="close action-close-insert-link"
data-dismiss="modal" aria-hidden="true">&times;</button>
<h3>Google+ image import</h3>
</div>
<div class="modal-body">
<div class="form-horizontal">
<div class="control-group">
<div class="controls">
<img>
</div>
</div>
<div class="control-group">
<label class="control-label" for="input-import-image-title">Title
(optional)</label>
<div class="controls">
<input type="text" id="input-import-image-title"
placeholder="Image title">
</div>
</div>
<div class="control-group">
<label class="control-label" for="input-import-image-size">Size
limit (optional)</label>
<div class="controls">
<input type="text" id="input-import-image-size" placeholder="123"
class="input-mini"><span class="help-inline">px</span>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<a href="#" class="btn" data-dismiss="modal">Cancel</a> <a href="#"
class="btn btn-primary action-import-image" data-dismiss="modal">OK</a>
</div>
</div>
<div id="modal-remove-file-confirm" class="modal hide">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"
aria-hidden="true">&times;</button>
<h3>Delete</h3>
</div>
<div class="modal-body">
<p>
Are you sure you want to delete "<span class="file-title"></span>"?
</p>
<blockquote class="muted">
<b>NOTE:</b> This will not delete the file on synchronized
locations.
</blockquote>
</div>
<div class="modal-footer">
<a href="#" class="btn" data-dismiss="modal">Cancel</a> <a href="#"
class="btn btn-primary action-remove-file" data-dismiss="modal">Delete</a>
</div>
</div>
<div id="modal-import-harddrive-markdown" class="modal hide">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"
aria-hidden="true">&times;</button>
<h3>Import from hard drive</h3>
</div>
<div class="modal-body">
<p>Please select your Markdown files here:</p>
<p>
<input type="file" id="input-file-import-harddrive-markdown"
multiple />
</p>
<p>Or drag and drop your Markdown files here:</p>
<p id="dropzone-import-harddrive-markdown" class="drop-zone">Drop
files here</p>
</div>
<div class="modal-footer">
<a href="#" class="btn btn-primary" data-dismiss="modal">Close</a>
</div>
</div>
<div id="modal-import-harddrive-html" class="modal hide">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"
aria-hidden="true">&times;</button>
<h3>Convert HTML to Markdown</h3>
</div>
<div class="modal-body">
<p>Please select your HTML files here:</p>
<p>
<input type="file" id="input-file-import-harddrive-html" multiple />
</p>
<p>Or drag and drop your HTML files here:</p>
<p id="dropzone-import-harddrive-html" class="drop-zone">Drop
files here</p>
<p>Or insert your HTML code here:</p>
<textarea id="input-convert-html"></textarea>
</div>
<div class="modal-footer">
<a href="#" class="btn" data-dismiss="modal">Close</a> <a href="#"
class="btn btn-primary action-convert-html" data-dismiss="modal">OK</a>
</div>
</div>
<div id="modal-upload-gdrive" class="modal hide">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"
aria-hidden="true">&times;</button>
<h3>Export to Google Drive</h3>
</div>
<div class="modal-body">
<blockquote class="muted">This will save the current
document to your Google Drive account and keep it synchronized.</blockquote>
<p>
Please specify a <b>folder ID</b> (optional):
</p>
<div class="input-prepend">
<span class="add-on"><i class="icon-gdrive"></i></span><input
id="input-sync-export-gdrive-parentid" type="text" class="span5"
placeholder="FolderID"></input>
</div>
<br /> <br />
<blockquote class="muted">
<b>NOTE:</b>
<ul>
<li>If no folder ID is supplied, the file will be created in
your root folder.</li>
<li>You can move or rename the file afterwards within Google
Drive.</li>
</ul>
</blockquote>
<p>
<label class="checkbox"> <input
id="input-sync-export-gdrive-realtime" type="checkbox">
Create a real time collaborative document
</label>
</p>
<blockquote class="muted">
<b>NOTE:</b>
<ul>
<li>Real time collaborative documents can't be open outside
StackEdit.</li>
<li>Real time collaborative documents can't have multiple
synchronized locations.</li>
</ul>
</blockquote>
</div>
<div class="modal-footer">
<a href="#" class="btn" data-dismiss="modal">Cancel</a> <a href="#"
data-dismiss="modal"
class="btn btn-primary action-sync-export-gdrive">OK</a>
</div>
</div>
<div id="modal-upload-dropbox" class="modal hide">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"
aria-hidden="true">&times;</button>
<h3>Export to Dropbox</h3>
</div>
<div class="modal-body">
<blockquote class="muted">This will save the current
document to your Dropbox account and keep it synchronized.</blockquote>
<p>
Please specify a <b>file path</b> for "<span class="file-title"></span>":
</p>
<div class="input-prepend">
<span class="add-on"><i class="icon-dropbox"></i></span><input
id="input-sync-export-dropbox-path" type="text" class="span5"
placeholder="/path/to/My Document.md"></input>
</div>
<br /> <br />
<blockquote class="muted">
<b>NOTE:</b>
<ul>
<li>Dropbox file path does not depend on document title.</li>
<li>The title of your document will not be synchronized.</li>
<li>Destination folder must exist.</li>
<li>Any existing file at this location will be overwritten.</li>
</ul>
</blockquote>
</div>
<div class="modal-footer">
<a href="#" class="btn" data-dismiss="modal">Cancel</a> <a href="#"
data-dismiss="modal"
class="btn btn-primary action-sync-export-dropbox">OK</a>
</div>
</div>
<div id="modal-manage-sync" class="modal hide">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"
aria-hidden="true">&times;</button>
<h3>Synchronization</h3>
</div>
<div class="modal-body">
<p class="msg-sync-list hide">
"<span class="file-title"></span>" is synchronized with the
following location(s):
</p>
<div id="manage-sync-list"></div>
<blockquote class="msg-sync-list hide muted">
<b>NOTE:</b> Removing a synchronized location will not delete any
file.
</blockquote>
<blockquote class="msg-no-sync hide muted">
"<span class="file-title"></span>" is not synchronized yet.
</blockquote>
<p>Add a synchronized location manually:</p>
<div class="input-prepend input-append sync-manual">
<span class="add-on" title="Google Drive"><i
class="icon-gdrive"></i></span><input id="input-sync-manual-gdrive-id"
type="text" class="span5" placeholder="GoogleDriveFileID"></input>
<a class="btn action-sync-manual-gdrive" title="Add location"
data-dismiss="modal"><i class="icon-ok"></i></a>
</div>
<div class="input-prepend input-append sync-manual">
<span class="add-on" title="Dropbox"><i class="icon-dropbox"></i></span><input
id="input-sync-manual-dropbox-path" type="text" class="span5"
placeholder="/dropbox/file/path"></input> <a
class="btn action-sync-manual-dropbox" title="Add location"
data-dismiss="modal"><i class="icon-ok"></i></a>
</div>
<blockquote class="muted">
<b>NOTE:</b> This will first upload the document and overwrite the
existing file on the server.
</blockquote>
</div>
<div class="modal-footer">
<a href="#" class="btn btn-primary" data-dismiss="modal">Close</a>
</div>
</div>
<div id="modal-publish" class="modal hide">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"
aria-hidden="true">&times;</button>
<h3>
Publish on <span class="publish-provider-name"></span>
</h3>
</div>
<div class="modal-body">
<div class="form-horizontal">
<div class="control-group modal-publish-ssh">
<label class="control-label" for="input-publish-ssh-host">Host</label>
<div class="controls">
<input type="text" id="input-publish-ssh-host"
placeholder="host.name.or.ip"> <span class="help-block">
Host must be accessible publicly, unless you are hosting your own
<a target="_blank"
href="https://github.com/benweet/stackedit-ssh-proxy">SSH
proxy</a>.
</span>
</div>
</div>
<div class="control-group modal-publish-ssh">
<label class="control-label" for="input-publish-ssh-port">Port
(optional)</label>
<div class="controls">
<input type="text" id="input-publish-ssh-port" placeholder="22">
</div>
</div>
<div class="control-group modal-publish-ssh">
<label class="control-label" for="input-publish-ssh-username">Username</label>
<div class="controls">
<input type="text" id="input-publish-ssh-username"
placeholder="username">
</div>
</div>
<div class="control-group modal-publish-ssh">
<label class="control-label" for="input-publish-ssh-password">Password</label>
<div class="controls">
<input type="password" id="input-publish-ssh-password"
placeholder="password"> <span class="help-block">
Passwords are transmitted in clear, unless you are hosting your
own <a target="_blank"
href="https://github.com/benweet/stackedit-ssh-proxy">SSH
proxy</a>.
</span>
</div>
</div>
<div class="control-group modal-publish-github">
<label class="control-label" for="input-publish-github-reponame">Repository</label>
<div class="controls">
<input type="text" id="input-publish-github-reponame"
placeholder="repository-name">
</div>
</div>
<div class="control-group modal-publish-github">
<label class="control-label" for="input-publish-github-username">Username
(optional)</label>
<div class="controls">
<input type="text" id="input-publish-github-username"
placeholder="username">
</div>
</div>
<div class="control-group modal-publish-github">
<label class="control-label" for="input-publish-github-branch">Branch</label>
<div class="controls">
<input type="text" id="input-publish-github-branch"
placeholder="branch-name">
</div>
</div>
<div class="control-group modal-publish-ssh modal-publish-github">
<label class="control-label" for="input-publish-file-path">File
path</label>
<div class="controls">
<input type="text" id="input-publish-file-path"
placeholder="path/to/file.md">
</div>
</div>
<div class="control-group modal-publish-gist">
<label class="control-label" for="input-publish-filename">Filename</label>
<div class="controls">
<input type="text" id="input-publish-filename"
placeholder="filename">
</div>
</div>
<div class="control-group modal-publish-gist">
<label class="control-label" for="input-publish-gist-id">Existing
ID (optional)</label>
<div class="controls">
<input type="text" id="input-publish-gist-id" placeholder="GistID">
</div>
</div>
<div class="control-group modal-publish-gist">
<label class="control-label" for="input-publish-gist-public">Public</label>
<div class="controls">
<input type="checkbox" id="input-publish-gist-public"
checked="checked" />
</div>
</div>
<div class="control-group modal-publish-blogger">
<label class="control-label" for="input-publish-blogger-url">Blog
URL</label>
<div class="controls">
<input type="text" id="input-publish-blogger-url"
placeholder="http://exemple.blogger.com/">
</div>
</div>
<div class="control-group modal-publish-tumblr">
<label class="control-label" for="input-publish-tumblr-hostname">Blog
hostname</label>
<div class="controls">
<input type="text" id="input-publish-tumblr-hostname"
placeholder="exemple.tumblr.com">
</div>
</div>
<div class="control-group modal-publish-wordpress">
<label class="control-label" for="input-publish-tumblr-hostname">WordPress
site</label>
<div class="controls">
<input type="text" id="input-publish-wordpress-site"
placeholder="exemple.wordpress.com"> <span
class="help-block"> <a target="_blank"
href="http://jetpack.me/">Jetpack plugin</a> is required for
self-hosted sites.
</span>
</div>
</div>
<div
class="control-group modal-publish-blogger modal-publish-tumblr modal-publish-wordpress">
<label class="control-label" for="input-publish-postid">Update
existing post ID (optional)</label>
<div class="controls">
<input type="text" id="input-publish-postid" placeholder="PostID">
</div>
</div>
<div class="control-group modal-publish-blogger">
<label class="control-label" for="input-publish-labels">Labels
(comma separated)</label>
<div class="controls">
<input type="text" id="input-publish-labels"
placeholder="Label1, Label2">
</div>
</div>
<div
class="control-group modal-publish-tumblr modal-publish-wordpress">
<label class="control-label" for="input-publish-tags">Tags
(comma separated)</label>
<div class="controls">
<input type="text" id="input-publish-tags"
placeholder="Tag1, Tag2">
</div>
</div>
<div class="control-group modal-publish-dropbox">
<label class="control-label" for="input-publish-dropbox-path">File
path</label>
<div class="controls">
<input type="text" id="input-publish-dropbox-path"
placeholder="/path/to/My Document.html">
</div>
</div>
<div class="control-group modal-publish-gdrive">
<label class="control-label" for="input-publish-gdrive-fileid">File
ID (optional)</label>
<div class="controls">
<input type="text" id="input-publish-gdrive-fileid"
placeholder="FileID"> <span class="help-block">If
no file ID is supplied, a new file will be created in your Google
Drive root folder. You can move the file afterwards within Google
Drive.</span>
</div>
</div>
<div class="control-group modal-publish-gdrive">
<label class="control-label" for="input-publish-gdrive-filename">Force
filename (optional)</label>
<div class="controls">
<input type="text" id="input-publish-gdrive-filename"
placeholder="Filename"> <span class="help-block">If
no file name is supplied, the document title will be used.</span>
</div>
</div>
<div class="control-group">
<div class="control-label">Format</div>
<div class="controls">
<label class="radio"> <input type="radio"
name="radio-publish-format" value="markdown"> Markdown
</label> <label class="radio"> <input type="radio"
name="radio-publish-format" value="html"> HTML
</label> <label class="radio"> <input type="radio"
name="radio-publish-format" value="template"> Template
</label>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<a href="#" class="btn" data-dismiss="modal">Cancel</a> <a href="#"
data-dismiss="modal" class="btn btn-primary action-process-publish">OK</a>
</div>
</div>
<div id="modal-manage-publish" class="modal hide">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"
aria-hidden="true">&times;</button>
<h3>Publication</h3>
</div>
<div class="modal-body">
<p class="msg-publish-list hide">
"<span class="file-title"></span>" is published on the following
location(s):
</p>
<div id="manage-publish-list"></div>
<blockquote class="muted">
<div class="msg-no-publish hide">
"<span class="file-title"></span>" is not published yet. <br /> <br />
</div>
<b>NOTE:</b> You can add publications using "Publish on" sub-menu.
</blockquote>
</div>
<div class="modal-footer">
<a href="#" class="btn btn-primary" data-dismiss="modal">Close</a>
</div>
</div>
<div id="modal-settings" class="modal hide">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"
aria-hidden="true">&times;</button>
<h3>Settings</h3>
<ul class="nav nav-tabs">
<li class="active"><a class="action-load-settings"
href="#tabpane-settings-editor" data-toggle="tab">Editor</a></li>
<li><a class="action-load-settings"
href="#tabpane-settings-publish" data-toggle="tab">Publish</a></li>
<li><a class="action-load-settings"
href="#tabpane-settings-extensions" data-toggle="tab">Extensions</a></li>
<li><a class="action-load-settings"
href="#tabpane-settings-utils" data-toggle="tab">Utils</a></li>
</ul>
</div>
<div class="modal-body">
<div class="tab-content">
<div class="tab-pane active" id="tabpane-settings-editor">
<div class="form-horizontal">
<div class="control-group">
<div class="control-label">Layout orientation</div>
<div class="controls">
<label class="radio"> <input type="radio"
name="radio-layout-orientation" value="horizontal">
Horizontal
</label> <label class="radio"> <input type="radio"
name="radio-layout-orientation" value="vertical">
Vertical
</label>
</div>
</div>
<div class="control-group">
<label class="control-label" for="input-settings-theme">Theme</label>
<div class="controls">
<select id="input-settings-theme">
</select> <span class="help-block"><a target="_blank"
href="https://github.com/benweet/stackedit/blob/master/doc/theming.md#stackedit-theming-guide">Create
your own theme...</a></span>
</div>
</div>
<div class="control-group">
<label class="control-label" for="input-settings-lazy-rendering">Lazy
rendering <a href="#" class="tooltip-lazy-rendering">(?)</a>
</label>
<div class="controls">
<input type="checkbox" id="input-settings-lazy-rendering" />
</div>
</div>
<div class="control-group">
<label class="control-label"
for="input-settings-editor-font-family">Editor font</label>
<div class="controls form-inline">
<input type="text" id="input-settings-editor-font-family"
class="span2"> <input type="text"
id="input-settings-editor-font-size" class="input-mini"><span
class="help-inline">px</span>
</div>
</div>
<div class="control-group">
<label class="control-label"
for="textarea-settings-default-content">Default content
<a href="#" class="tooltip-default-content">(?)</a>
</label>
<div class="controls">
<textarea id="textarea-settings-default-content"></textarea>
</div>
</div>
</div>
</div>
<div class="tab-pane" id="tabpane-settings-publish">
<div class="form-horizontal">
<div class="control-group">
<label class="control-label"
for="input-settings-publish-commit-msg">Commit message</label>
<div class="controls">
<input type="text" id="input-settings-publish-commit-msg">
</div>
</div>
<div class="control-group">
<label class="control-label"
for="textarea-settings-publish-template">Template <a
href="#" class="tooltip-template">(?)</a>
</label>
<div class="controls">
<textarea id="textarea-settings-publish-template"></textarea>
</div>
</div>
<div class="control-group">
<label class="control-label" for="input-settings-ssh-proxy">SSH
proxy</label>
<div class="controls">
<input type="text" id="input-settings-ssh-proxy">
</div>
</div>
</div>
</div>
<div class="tab-pane" id="tabpane-settings-extensions">
<div class="accordion" id="accordion-extensions"></div>
<span class="help-block pull-right"><a target="_blank"
href="https://github.com/benweet/stackedit/blob/master/doc/developer-guide.md#architecture">Create
your own extension...</a></span>
</div>
<div class="tab-pane" id="tabpane-settings-utils">
<div class="tab-pane-button-container">
<a href="#"
class="btn btn-block btn-primary action-import-settings"><i
class="icon-wrench icon-white"></i> Import settings</a> <a href="#"
class="btn btn-block btn-primary action-export-settings"
data-dismiss="modal"><i class="icon-wrench icon-white"></i>
Export settings</a> <a href="#"
class="btn btn-block btn-primary action-default-settings"
data-dismiss="modal"><i class="icon-wrench icon-white"></i>
Load default settings</a> <input type="file"
id="input-file-import-settings" class="hide">
</div>
<div class="tab-pane-button-container">
<a href="#" class="btn btn-block btn-primary action-welcome-file"
data-dismiss="modal"><i class="icon-info-sign icon-white"></i>
Welcome document</a> <a href="#" class="btn btn-block btn-primary"
data-dismiss="modal" data-toggle="modal"
data-target="#modal-app-reset"><i
class="icon-fire icon-white"></i> Reset application</a>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<a href="#" class="btn" data-dismiss="modal">Cancel</a> <a href="#"
class="btn btn-primary action-apply-settings" data-dismiss="modal">OK</a>
</div>
</div>
<div id="modal-about" class="modal hide">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"
aria-hidden="true">&times;</button>
<img src="img/stackedit-promo.png" />
</div>
<div class="modal-body"></div>
<div class="modal-footer">
<a href="#" class="btn btn-primary" data-dismiss="modal">Close</a>
</div>
</div>
<div id="modal-non-unique" class="modal hide">
<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>
</div>
<div id="modal-app-reset" class="modal hide">
<div class="modal-header">
<h3>Reset application</h3>
</div>
<div class="modal-body">
<p>This will delete all your local documents.</p>
<blockquote class="muted">Are you sure?</blockquote>
</div>
<div class="modal-footer">
<a href="#" class="btn" data-dismiss="modal">Cancel</a> <a href="#"
class="btn btn-primary action-app-reset" data-dismiss="modal">OK</a>
</div>
</div>
<textarea id="md-section-helper"></textarea>
<div class="lock-ui hide"></div>
<div id="dropboxjs" data-app-key="x0k2l8puemfvg0o"></div>
</body>
</html>

View File

@ -1,11 +1,10 @@
define([
"underscore",
"core",
"utils",
"eventMgr",
"config",
"libs/stacktrace",
], function(_, core, utils, eventMgr) {
], function(_, utils, eventMgr) {
var taskQueue = [];
@ -125,11 +124,17 @@ define([
var currentTaskRunning = false;
var currentTaskStartTime = 0;
// Determine if user is real by listening to his activity
var isUserReal = false;
eventMgr.addListener("onUserActive", function() {
isUserReal = true;
});
// Run the next task in the queue if any and no other running
function runTask() {
// Wait for user first interaction before running first task
if(core.isUserReal === false) {
if(isUserReal === false) {
return
}
@ -168,8 +173,8 @@ define([
});
}
// Call runTask function periodically
core.runPeriodically(runTask);
// Call runTask periodically
eventMgr.addListener("onPeriodicRun", runTask);
function runSafe(task, callbacks, param) {
try {

View File

@ -18,22 +18,20 @@ define([
// Used for periodic tasks
var intervalId = undefined;
var periodicCallbacks = [
eventMgr.onPeriodicRun
];
core.runPeriodically = function(callback) {
periodicCallbacks.push(callback);
};
// Used to detect user activity
core.isUserReal = false;
var isUserReal = false;
var userActive = false;
var windowUnique = true;
var userLastActivity = 0;
function setUserActive() {
core.isUserReal = true;
isUserReal = true;
userActive = true;
userLastActivity = utils.currentTime;
var currentTime = utils.currentTime;
if(currentTime > userLastActivity + 1000) {
userLastActivity = currentTime;
eventMgr.onUserActive();
}
}
function isUserActive() {
@ -46,7 +44,7 @@ define([
// Used to only have 1 window of the application in the same browser
var windowId = undefined;
function checkWindowUnique() {
if(core.isUserReal === false || windowUnique === false) {
if(isUserReal === false || windowUnique === false) {
return;
}
if(windowId === undefined) {
@ -68,24 +66,24 @@ define([
}
// Offline management
core.isOffline = false;
var isOffline = false;
var offlineTime = utils.currentTime;
core.setOffline = function() {
offlineTime = utils.currentTime;
if(core.isOffline === false) {
core.isOffline = true;
if(isOffline === false) {
isOffline = true;
eventMgr.onOfflineChanged(true);
}
};
function setOnline() {
if(core.isOffline === true) {
core.isOffline = false;
if(isOffline === true) {
isOffline = false;
eventMgr.onOfflineChanged(false);
}
}
function checkOnline() {
// Try to reconnect if we are offline but we have some network
if(core.isOffline === true && navigator.onLine === true && offlineTime + CHECK_ONLINE_PERIOD < utils.currentTime) {
if(isOffline === true && navigator.onLine === true && offlineTime + CHECK_ONLINE_PERIOD < utils.currentTime) {
offlineTime = utils.currentTime;
// Try to download anything to test the connection
$.ajax({
@ -254,12 +252,14 @@ define([
var converter = new Markdown.Converter();
// Create MD sections for extensions
converter.hooks.chain("preConversion", function(text) {
eventMgr.previewStartTime = new Date();
var tmpText = text + "\n\n";
var sectionList = [], offset = 0;
// Look for titles (excluding gfm blocs)
tmpText.replace(/^```.*\n[\s\S]*?\n```|(^.+[ \t]*\n=+[ \t]*\n+|^.+[ \t]*\n-+[ \t]*\n+|^\#{1,6}[ \t]*.+?[ \t]*\#*\n+)/gm, function(match, title, matchOffset) {
if(title) {
// We just found a title which means end of the previous section
// We just found a title which means end of the previous
// section
// Exclude last \n of the section
sectionList.push(tmpText.substring(offset, matchOffset));
offset = matchOffset;
@ -318,7 +318,6 @@ define([
else {
previewWrapper = function(makePreview) {
return function() {
eventMgr.previewStartTime = new Date();
makePreview();
if(documentContent === undefined) {
previewContainerElt.scrollTop(fileDesc.previewScrollTop);
@ -339,20 +338,21 @@ define([
$("#wmd-bold-button").append($('<i class="icon-bold">'));
$("#wmd-italic-button").append($('<i class="icon-italic">'));
$("#wmd-link-button").append($('<i class="icon-globe">'));
$("#wmd-quote-button").append($('<i class="icon-indent-left">'));
$("#wmd-quote-button").append($('<i class="icon-indent-right">'));
$("#wmd-code-button").append($('<i class="icon-code">'));
$("#wmd-image-button").append($('<i class="icon-picture">'));
$("#wmd-olist-button").append($('<i class="icon-numbered-list">'));
$("#wmd-ulist-button").append($('<i class="icon-list">'));
$("#wmd-olist-button").append($('<i class="icon-list-numbered">'));
$("#wmd-ulist-button").append($('<i class="icon-list-bullet">'));
$("#wmd-heading-button").append($('<i class="icon-text-height">'));
$("#wmd-hr-button").append($('<i class="icon-hr">'));
$("#wmd-undo-button").append($('<i class="icon-undo">'));
$("#wmd-redo-button").append($('<i class="icon-share-alt">'));
$("#wmd-hr-button").append($('<i class="icon-ellipsis">'));
$("#wmd-undo-button").append($('<i class="icon-reply">'));
$("#wmd-redo-button").append($('<i class="icon-forward">'));
eventMgr.onFileOpen(fileDesc);
};
// Used to lock the editor from the user interaction during asynchronous tasks
// Used to lock the editor from the user interaction during asynchronous
// tasks
var uiLocked = false;
core.lockUI = function(param) {
uiLocked = param;
@ -366,33 +366,7 @@ define([
}
};
// onReady event callbacks
var readyCallbacks = [];
core.onReady = function(callback) {
readyCallbacks.push(callback);
runReadyCallbacks();
};
var ready = false;
core.setReady = function() {
ready = true;
runReadyCallbacks();
};
function runReadyCallbacks() {
if(ready === true) {
_.each(readyCallbacks, function(callback) {
callback();
});
readyCallbacks = [];
}
}
core.onReady(function() {
// Load theme list
_.each(THEME_LIST, function(name, value) {
$("#input-settings-theme").append($('<option value="' + value + '">' + name + '</option>'));
});
function init() {
// listen to online/offline events
$(window).on('offline', core.setOffline);
@ -439,6 +413,84 @@ define([
return uiLocked || shownModalId || $(element).is("input, select, textarea:not(#wmd-input)");
};
// UI layout
createLayout();
// Editor's textarea
$("#wmd-input, #md-section-helper").css({
// Apply editor font
"font-family": settings.editorFontFamily,
"font-size": settings.editorFontSize + "px",
"line-height": Math.round(settings.editorFontSize * (20 / 14)) + "px"
});
// Handle tab key
$("#wmd-input").keydown(function(e) {
if(e.keyCode === 9) {
var value = $(this).val();
var start = this.selectionStart;
var end = this.selectionEnd;
// IE8 does not support selection attributes
if(start === undefined || end === undefined) {
return;
}
$(this).val(value.substring(0, start) + "\t" + value.substring(end));
this.selectionStart = this.selectionEnd = start + 1;
e.preventDefault();
}
});
// Do periodic tasks
intervalId = window.setInterval(function() {
utils.updateCurrentTime();
checkWindowUnique();
if(isUserActive() === true || viewerMode === true) {
eventMgr.onPeriodicRun();
checkOnline();
}
}, 1000);
eventMgr.onReady();
}
// Initialize multiple things and then fire eventMgr.onReady
core.onReady = function() {
if(viewerMode === true) {
require([
"text!html/bodyViewer.html",
], function(bodyViewerHTML) {
$('body').html(bodyViewerHTML);
init();
});
}
else {
require([
"text!html/bodyIndex.html",
"text!html/dialogInsertLink.html",
"text!html/dialogInsertImage.html",
"text!html/dialogImportImage.html",
"text!html/dialogRemoveFileConfirm.html",
], function(bodyIndexHTML, dialogInsertLinkHTML, dialogInsertImageHTML, dialogImportImageHTML, dialogRemoveFileConfirmHTML) {
$('body').html(bodyIndexHTML);
utils.addModal('modal-insert-link', dialogInsertLinkHTML);
utils.addModal('modal-insert-image', dialogInsertImageHTML);
utils.addModal('modal-import-image', dialogImportImageHTML);
utils.addModal('modal-remove-file-confirm', dialogRemoveFileConfirmHTML);
init();
});
}
};
// 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>';
}, "");
$("#input-settings-theme").html(themeOptions);
// Click events on "insert link" and "insert image" dialog buttons
$(".action-insert-link").click(function(e) {
var value = utils.getInputTextValue($("#input-insert-link"), e);
@ -516,56 +568,11 @@ define([
window.location.reload();
});
// UI layout
$("#menu-bar, .ui-layout-center, .ui-layout-east, .ui-layout-south").removeClass("hide");
createLayout();
// Editor's textarea
$("#wmd-input, #md-section-helper").css({
// Apply editor font
"font-family": settings.editorFontFamily,
"font-size": settings.editorFontSize + "px",
"line-height": Math.round(settings.editorFontSize * (20 / 14)) + "px"
});
// Handle tab key
$("#wmd-input").keydown(function(e) {
if(e.keyCode === 9) {
var value = $(this).val();
var start = this.selectionStart;
var end = this.selectionEnd;
// IE8 does not support selection attributes
if(start === undefined || end === undefined) {
return;
}
$(this).val(value.substring(0, start) + "\t" + value.substring(end));
this.selectionStart = this.selectionEnd = start + 1;
e.preventDefault();
}
});
// Reset inputs
$(".action-reset-input").click(function() {
utils.resetModalInputs();
});
// Do periodic tasks
intervalId = window.setInterval(function() {
utils.updateCurrentTime();
checkWindowUnique();
if(isUserActive() === true || viewerMode === true) {
_.each(periodicCallbacks, function(callback) {
callback();
});
checkOnline();
}
}, 1000);
});
core.onReady(eventMgr.onReady);
// After extensions onReady callbacks
core.onReady(function() {
// Tooltips
$(".tooltip-lazy-rendering").tooltip({
container: '#modal-settings',

View File

@ -121,6 +121,7 @@ define([
addEventHook("onMessage");
addEventHook("onError");
addEventHook("onOfflineChanged");
addEventHook("onUserActive");
addEventHook("onAsyncRunning", true);
addEventHook("onPeriodicRun", true);

View File

@ -150,7 +150,7 @@ define([
});
};
core.onReady(function() {
eventMgr.addListener("onReady", function() {
fileMgr.selectFile();

View File

@ -11,10 +11,16 @@ define([
var dropboxHelper = {};
// Listen to offline status changes
var isOffline = false;
eventMgr.addListener("onOfflineChanged", function(isOfflineParam) {
isOffline = isOfflineParam;
});
// Try to connect dropbox by downloading client.js
function connect(task) {
task.onRun(function() {
if(core.isOffline === true) {
if(isOffline === true) {
client = undefined;
task.error(new Error("Operation not available in offline mode.|stopPublish"));
return;

View File

@ -11,10 +11,16 @@ define([
var githubHelper = {};
// Listen to offline status changes
var isOffline = false;
eventMgr.addListener("onOfflineChanged", function(isOfflineParam) {
isOffline = isOfflineParam;
});
// Try to connect github by downloading js file
function connect(task) {
task.onRun(function() {
if(core.isOffline === true) {
if(isOffline === true) {
connected = false;
task.error(new Error("Operation not available in offline mode.|stopPublish"));
return;

View File

@ -11,10 +11,16 @@ define([
var googleHelper = {};
// Listen to offline status changes
var isOffline = false;
eventMgr.addListener("onOfflineChanged", function(isOfflineParam) {
isOffline = isOfflineParam;
});
// Try to connect Gdrive by downloading client.js
function connect(task) {
task.onRun(function() {
if(core.isOffline === true) {
if(isOffline === true) {
connected = false;
task.error(new Error("Operation not available in offline mode.|stopPublish"));
return;

View File

@ -1,16 +1,23 @@
define([
"jquery",
"core",
"eventMgr",
"settings",
"classes/AsyncTask"
], function($, core, settings, AsyncTask) {
], function($, core, eventMgr, settings, AsyncTask) {
var sshHelper = {};
// Listen to offline status changes
var isOffline = false;
eventMgr.addListener("onOfflineChanged", function(isOfflineParam) {
isOffline = isOfflineParam;
});
// Only used to check the offline status
function connect(task) {
task.onRun(function() {
if(core.isOffline === true) {
if(isOffline === true) {
task.error(new Error("Operation not available in offline mode.|stopPublish"));
return;
}

View File

@ -10,10 +10,16 @@ define([
var tumblrHelper = {};
// Listen to offline status changes
var isOffline = false;
eventMgr.addListener("onOfflineChanged", function(isOfflineParam) {
isOffline = isOfflineParam;
});
// Only used to check the offline status
function connect(task) {
task.onRun(function() {
if(core.isOffline === true) {
if(isOffline === true) {
task.error(new Error("Operation not available in offline mode.|stopPublish"));
return;
}

View File

@ -10,10 +10,16 @@ define([
var wordpressHelper = {};
// Listen to offline status changes
var isOffline = false;
eventMgr.addListener("onOfflineChanged", function(isOfflineParam) {
isOffline = isOfflineParam;
});
// Only used to check the offline status
function connect(task) {
task.onRun(function() {
if(core.isOffline === true) {
if(isOffline === true) {
task.error(new Error("Operation not available in offline mode.|stopPublish"));
return;
}

View File

@ -1,5 +1,5 @@
<button class="btn dropdown-toggle" title="Markdown syntax" data-toggle="dropdown">
<i class="icon-question-sign"></i>
<i class="icon-help-circled"></i>
</button>
<div class="dropdown-menu pull-right">
<h3>Markdown syntax</h3>

View File

@ -1,5 +1,5 @@
<button class="btn dropdown-toggle" title="Document statistics" data-toggle="dropdown">
<i class="icon-stat"></i>
<i class="icon-chart-bar"></i>
</button>
<div class="dropdown-menu pull-right">
<h3>Statistics</h3>

View File

@ -1,4 +1,4 @@
<a href="viewer.html" class="btn dropdown-toggle"
title="Open in viewer">
<i class="icon-fullscreen"></i>
<i class="icon-resize-full"></i>
</a>

2858
js/libs/bootstrap.js vendored

File diff suppressed because it is too large Load Diff

6252
js/libs/jquery-ui.js vendored

File diff suppressed because it is too large Load Diff

8580
js/libs/jquery.js vendored

File diff suppressed because it is too large Load Diff

View File

@ -9,6 +9,10 @@ requirejs.config({
"mousetrap": "libs/mousetrap",
"toMarkdown": "libs/to-markdown",
"text": "libs/text",
"css": "libs/css",
"less": "libs/less",
"lessc": "libs/lessc",
"normalize": "libs/normalize",
"libs/MathJax": '../lib/MathJax/MathJax.js?config=TeX-AMS_HTML'
},
shim: {
@ -79,7 +83,12 @@ require([
"core",
"synchronizer",
"publisher",
"mediaImporter"
"mediaImporter",
"css!styles/fontello.css",
"css!styles/jgrowl.css",
"css!styles/prettify.css",
"css!styles/highlight.css",
"less!styles/default.less",
], function($, core) {
$(function() {
@ -95,7 +104,7 @@ require([
}
// Here, all the modules are loaded and the DOM is ready
core.setReady();
core.onReady();
});
});

View File

@ -17,7 +17,7 @@ define([
];
}).compact().object().value();
core.onReady(function() {
eventMgr.addListener("onReady", function() {
_.each(providerMap, function(provider) {
// Import image action links (if any)
$(".action-import-image-" + provider.providerId).click(function() {

View File

@ -1,9 +1,8 @@
define([
"jquery",
"core",
"classes/Provider",
"classes/AsyncTask"
], function($, core, Provider, AsyncTask) {
], function($, Provider, AsyncTask) {
var downloadProvider = new Provider("download");
downloadProvider.sharingAttributes = [

View File

@ -1,13 +1,12 @@
define([
"underscore",
"core",
"utils",
"classes/Provider",
"settings",
"eventMgr",
"fileMgr",
"helpers/googleHelper"
], function(_, core, utils, Provider, settings, eventMgr, fileMgr, googleHelper) {
], function(_, utils, Provider, settings, eventMgr, fileMgr, googleHelper) {
var PROVIDER_GDRIVE = "gdrive";
@ -401,7 +400,7 @@ define([
editor.uiManager.setUndoRedoButtonStates();
};
core.onReady(function() {
eventMgr.addListener("onReady", function() {
var state = utils.retrieveIgnoreError(PROVIDER_GDRIVE + ".state");
if(state === undefined) {
return;

View File

@ -1,11 +1,10 @@
define([
"underscore",
"core",
"utils",
"classes/Provider",
"eventMgr",
"helpers/googleHelper"
], function(_, core, utils, Provider, eventMgr, googleHelper) {
], function(_, utils, Provider, eventMgr, googleHelper) {
var PROVIDER_GPLUS = "gplus";
@ -77,7 +76,7 @@ define([
});
};
core.onReady(function() {
eventMgr.addListener("onReady", function() {
$(".action-import-image").click(function(e) {
var size = utils.getInputIntValue("#input-import-image-size", undefined, 0) || 0;
var title = utils.getInputTextValue("#input-import-image-title");

View File

@ -1,7 +1,6 @@
define([
"jquery",
"underscore",
"core",
"utils",
"settings",
"eventMgr",
@ -17,7 +16,7 @@ define([
"providers/sshProvider",
"providers/tumblrProvider",
"providers/wordpressProvider"
], function($, _, core, utils, settings, eventMgr, fileSystem, fileMgr, sharing, Provider) {
], function($, _, utils, settings, eventMgr, fileSystem, fileMgr, sharing, Provider) {
var publisher = {};
@ -127,11 +126,16 @@ define([
previewHtml = html;
});
// Listen to offline status changes
var isOffline = false;
eventMgr.addListener("onOfflineChanged", function(isOfflineParam) {
isOffline = isOfflineParam;
});
var publishRunning = false;
publisher.publish = function() {
// If publish is running or offline
if(publishRunning === true || core.isOffline) {
if(publishRunning === true || isOffline === true) {
return;
}
@ -218,7 +222,7 @@ define([
localStorage[provider.providerId + ".publishPreferences"] = JSON.stringify(publishPreferences);
}
core.onReady(function() {
eventMgr.addListener("onReady", function() {
// Add every provider
var publishMenu = $("#publish-menu");
_.each(providerMap, function(provider) {

View File

@ -1,7 +1,6 @@
define([
"jquery",
"underscore",
"core",
"utils",
"eventMgr",
"fileMgr",
@ -9,7 +8,7 @@ define([
"classes/Provider",
"providers/downloadProvider",
"providers/gistProvider"
], function($, _, core, utils, eventMgr, fileMgr, AsyncTask, Provider) {
], function($, _, utils, eventMgr, fileMgr, AsyncTask, Provider) {
var sharing = {};
@ -21,6 +20,12 @@ define([
];
}).compact().object().value();
// Listen to offline status changes
var isOffline = false;
eventMgr.addListener("onOfflineChanged", function(isOfflineParam) {
isOffline = isOfflineParam;
});
sharing.createLink = function(attributes, callback) {
var provider = providerMap[attributes.provider.providerId];
// Don't create link if link already exists or provider is not
@ -34,7 +39,7 @@ define([
var task = new AsyncTask();
var shortUrl = undefined;
task.onRun(function() {
if(core.isOffline === true) {
if(isOffline === true) {
task.chain();
return;
}
@ -73,7 +78,7 @@ define([
task.enqueue();
};
core.onReady(function() {
eventMgr.addListener("onReady", function() {
if(viewerMode === false) {
return;
}

View File

@ -1,7 +1,6 @@
define([
"jquery",
"underscore",
"core",
"utils",
"eventMgr",
"fileSystem",
@ -9,7 +8,7 @@ define([
"classes/Provider",
"providers/dropboxProvider",
"providers/gdriveProvider"
], function($, _, core, utils, eventMgr, fileSystem, fileMgr, Provider) {
], function($, _, utils, eventMgr, fileSystem, fileMgr, Provider) {
var synchronizer = {};
@ -171,11 +170,17 @@ define([
providerDown(callback);
}
// Listen to offline status changes
var isOffline = false;
eventMgr.addListener("onOfflineChanged", function(isOfflineParam) {
isOffline = isOfflineParam;
});
// Main entry point for synchronization
var syncRunning = false;
synchronizer.sync = function() {
// If sync is already running or offline
if(syncRunning || core.isOffline) {
if(syncRunning === true || isOffline === true) {
return false;
}
syncRunning = true;
@ -282,7 +287,7 @@ define([
$("#modal-upload-" + provider.providerId).modal();
}
core.onReady(function() {
eventMgr.addListener("onReady", function() {
// Init each provider
_.each(providerMap, function(provider) {
// Provider's import button

View File

@ -1,9 +1,10 @@
define([
"jquery",
"underscore",
"crel",
"libs/FileSaver",
"libs/stacktrace",
], function($, _) {
], function($, _, crel) {
var utils = {};
@ -168,6 +169,15 @@ define([
return url;
};
utils.addModal = function(id, content) {
var modal = crel('div', {
id: id,
class: 'modal'
});
modal.innerHTML = content;
document.getElementsByTagName('body')[0].appendChild(modal);
};
// Create an centered popup window
utils.popupWindow = function(url, title, width, height) {
var left = (screen.width / 2) - (width / 2);

View File

@ -34,78 +34,5 @@
<script src="js/libs/require.js"></script>
</head>
<body class="viewer">
<div class="navbar navbar-fixed-top ui-layout-north">
<div class="navbar-inner">
<ul class="nav pull-right hide" id="menu-bar">
<li class="btn-group">
<button class="btn action-edit-document hide"
title="Edit this document">
<i class="icon-pencil"></i>
</button>
</li>
<li class="btn-group">
<button class="btn dropdown-toggle" data-toggle="dropdown"
title="Save this document">
<i class="icon-download-alt"></i>
</button>
<ul class="dropdown-menu">
<li><a class="action-download-md" href="#"><i
class="icon-download-alt"></i> Save as Markdown</a></li>
<li><a class="action-download-html" href="#"><i
class="icon-download-alt"></i> Save as HTML</a></li>
<li><a class="action-download-template" href="#"><i
class="icon-download-alt"></i> Save using template</a></li>
</ul>
</li>
<li class="btn-group">
<button class="btn 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 action-open-stackedit"
title="Open StackEdit">
<i class="icon-stackedit"></i>
</button></li>
</ul>
<ul class="nav pull-right">
<li><i class="working-indicator icon-none"></i></li>
<li><span class="brand" id="file-title"></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>
</div>
<div id="modal-non-unique" class="modal hide">
<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>
</div>
</body>
</html>