Async HTML loading

This commit is contained in:
benweet 2013-06-10 22:22:32 +01:00
parent eadb6eb186
commit 601ae40441
67 changed files with 774 additions and 521 deletions

View File

@ -535,9 +535,13 @@ div.dropdown-menu i {
margin-bottom: 10px; margin-bottom: 10px;
} }
#modal-settings .accordion-heading .checkbox { #modal-settings .accordion-heading {
padding: 8px 15px; padding: 8px 15px;
margin-bottom: 0px; }
#modal-settings .accordion-heading .accordion-toggle {
display: inline;
padding: 0;
} }
#modal-settings .accordion-inner { #modal-settings .accordion-inner {
@ -545,10 +549,6 @@ div.dropdown-menu i {
padding: 10px 40px; padding: 10px 40px;
} }
#modal-settings .accordion-inner .form-horizontal .control-group {
color: #999;
}
#modal-settings .accordion-inner .form-horizontal .control-label { #modal-settings .accordion-inner .form-horizontal .control-label {
text-align: left; text-align: left;
} }
@ -557,10 +557,6 @@ div.dropdown-menu i {
margin: 0 10px; margin: 0 10px;
} }
#modal-settings .accordion-toggle {
cursor: help;
}
#modal-settings .tab-pane-button-container { #modal-settings .tab-pane-button-container {
width: 200px; width: 200px;
margin: 10px auto; margin: 10px auto;

13
css/main-min.css vendored
View File

@ -5793,26 +5793,23 @@ div.dropdown-menu i {
border-radius: inherit; border-radius: inherit;
margin-bottom: 10px; margin-bottom: 10px;
} }
#modal-settings .accordion-heading .checkbox { #modal-settings .accordion-heading {
padding: 8px 15px; padding: 8px 15px;
margin-bottom: 0px; }
#modal-settings .accordion-heading .accordion-toggle {
display: inline;
padding: 0;
} }
#modal-settings .accordion-inner { #modal-settings .accordion-inner {
border: 0; border: 0;
padding: 10px 40px; padding: 10px 40px;
} }
#modal-settings .accordion-inner .form-horizontal .control-group {
color: #999;
}
#modal-settings .accordion-inner .form-horizontal .control-label { #modal-settings .accordion-inner .form-horizontal .control-label {
text-align: left; text-align: left;
} }
#modal-settings .accordion-inner .form-inline .label-text { #modal-settings .accordion-inner .form-inline .label-text {
margin: 0 10px; margin: 0 10px;
} }
#modal-settings .accordion-toggle {
cursor: help;
}
#modal-settings .tab-pane-button-container { #modal-settings .tab-pane-button-container {
width: 200px; width: 200px;
margin: 10px auto; margin: 10px auto;

View File

@ -115,7 +115,7 @@
</ul> </ul>
</div> </div>
</div> </div>
<textarea id="wmd-input" class="ui-layout-center mousetrap hide"></textarea> <textarea id="wmd-input" class="ui-layout-center hide"></textarea>
<div class="ui-layout-east preview-container hide"></div> <div class="ui-layout-east preview-container hide"></div>
<div class="ui-layout-south preview-container hide"></div> <div class="ui-layout-south preview-container hide"></div>
@ -671,124 +671,6 @@
<img src="img/stackedit-promo.png" /> <img src="img/stackedit-promo.png" />
</div> </div>
<div class="modal-body"> <div class="modal-body">
<dl>
<dt>About:</dt>
<dd>
<a target="_blank" href="https://github.com/benweet/stackedit/">GitHub
page</a> / <a target="_blank"
href="https://github.com/benweet/stackedit/issues">issue
tracker</a>
</dd>
<dd>
<a target="_blank"
href="https://chrome.google.com/webstore/detail/stackedit/iiooodelglhkcpgbajoejffhijaclcdg">Chrome
app</a> (thanks for your review!)
</dd>
<dd>
<a target="_blank" href="https://twitter.com/stackedit/">Follow
on Twitter</a>
</dd>
<dd>
<a target="_blank" href="https://www.facebook.com/stackedit/">Follow
on Facebook</a>
</dd>
<dd>
<a target="_blank"
href="https://plus.google.com/110816046787593496375"
rel="publisher">Follow on Google+</a>
</dd>
</dl>
<dl>
<dt>Developers:</dt>
<dd>
<a target="_blank" href="http://www.benoitschweblin.com">Benoit
Schweblin</a>
<dd>
<dd>Pete Eigel (contributor)
<dd>
</dl>
<dl>
<dt>Credit:</dt>
<dd>
<a target="_blank" href="http://twitter.github.io/bootstrap/">Bootstrap</a>
</dd>
<dd>
<a target="_blank"
href="https://github.com/rafaelp/css_browser_selector/">CSS
Browser Selector</a>
</dd>
<dd>
<a target="_blank" href="https://github.com/dropbox/dropbox-js">Dropbox-js</a>
</dd>
<dd>
<a target="_blank" href="https://github.com/eligrey/FileSaver.js/">FileSaver.js</a>
</dd>
<dd>
<a target="_blank" href="https://github.com/michael/github">Github.js</a>
/ <a target="_blank" href="https://github.com/prose/gatekeeper">Gatekeeper</a>
</dd>
<dd>
<a target="_blank" href="http://glyphicons.com/">Glyphicons</a>
</dd>
<dd>
<a target="_blank" href="https://github.com/stanlemon/jGrowl/">jGrowl</a>
</dd>
<dd>
<a target="_blank" href="http://jquery.com/">jQuery</a>
</dd>
<dd>
<a target="_blank" href="https://github.com/brandonaaron/jquery-mousewheel">jQuery Mouse Wheel Plugin</a>
</dd>
<dd>
<a target="_blank" href="https://code.google.com/p/pagedown/">PageDown</a>
/ <a target="_blank"
href="https://github.com/jmcmanus/pagedown-extra/">Pagedown-extra</a>
</dd>
<dd>
<a target="_blank"
href="https://code.google.com/p/google-code-prettify/">Prettify</a>
</dd>
<dd>
<a target="_blank" href="http://requirejs.org/">RequireJS</a>
</dd>
<dd>
<a target="_blank" href="http://layout.jquery-dev.net/">UI
Layout</a>
</dd>
<dd>
<a target="_blank" href="http://underscorejs.org/">Underscore.js</a>
</dd>
<dd>
<a target="_blank" href="https://github.com/alexanderdickson/waitForImages">waitForImages</a>
</dd>
</dl>
<dl>
<dt>Related projects:</dt>
<dd>
<a target="_blank"
href="https://github.com/benweet/stackedit-download-proxy">StackEdit
Download Proxy</a>
</dd>
<dd>
<a target="_blank"
href="https://github.com/benweet/stackedit-ssh-proxy">StackEdit
SSH Proxy</a>
</dd>
<dd>
<a target="_blank"
href="https://github.com/benweet/stackedit-tumblr-proxy">StackEdit
Tumblr Proxy</a>
</dd>
<dd>
<a target="_blank"
href="https://github.com/benweet/stackedit-wordpress-proxy">StackEdit
WordPress Proxy</a>
</dd>
</dl>
<p>Copyright 2013 <a target="_blank"
href="http://www.benoitschweblin.com">Benoit Schweblin</a><br />
Licensed under an <a target="_blank"
href="http://www.apache.org/licenses/LICENSE-2.0">Apache License</a></p>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<a href="#" class="btn btn-primary" data-dismiss="modal">Close</a> <a href="#" class="btn btn-primary" data-dismiss="modal">Close</a>

View File

@ -6,7 +6,7 @@ define([
"underscore", "underscore",
"core", "core",
"utils", "utils",
"extension-manager" "extensionMgr"
], function(_, core, utils, extensionMgr) { ], function(_, core, utils, extensionMgr) {
var asyncRunner = {}; var asyncRunner = {};

View File

@ -1,4 +1,5 @@
var MAIN_URL = "http://benweet.github.io/stackedit/"; var MAIN_URL = "http://benweet.github.io/stackedit/";
var GOOGLE_ANALYTICS_ACCOUNT_ID = "UA-39556145-1";
var GOOGLE_API_KEY = "AIzaSyAeCU8CGcSkn0z9js6iocHuPBX4f_mMWkw"; var GOOGLE_API_KEY = "AIzaSyAeCU8CGcSkn0z9js6iocHuPBX4f_mMWkw";
var GOOGLE_SCOPES = [ var GOOGLE_SCOPES = [
"https://www.googleapis.com/auth/drive.install", "https://www.googleapis.com/auth/drive.install",

View File

@ -3,13 +3,15 @@ define([
"underscore", "underscore",
"utils", "utils",
"settings", "settings",
"extension-manager", "extensionMgr",
"mousetrap",
"text!html/settingsTemplateTooltip.html",
"storage", "storage",
"config", "config",
"libs/bootstrap", "libs/bootstrap",
"libs/layout", "libs/layout",
"libs/Markdown.Editor" "libs/Markdown.Editor"
], function($, _, utils, settings, extensionMgr) { ], function($, _, utils, settings, extensionMgr, mousetrap, settingsTemplateTooltipHTML) {
var core = {}; var core = {};
@ -363,7 +365,6 @@ define([
if(shownModalId != modalId) { if(shownModalId != modalId) {
// Hack to avoid conflict with tabs, collapse, tooltips events // Hack to avoid conflict with tabs, collapse, tooltips events
shownModalId = modalId; shownModalId = modalId;
Mousetrap.pause();
_.defer(function(elt) { _.defer(function(elt) {
elt.find("input:enabled:visible:first").focus(); elt.find("input:enabled:visible:first").focus();
}, $(this)); }, $(this));
@ -373,10 +374,7 @@ define([
var modalId = $(this).attr("id"); var modalId = $(this).attr("id");
if(shownModalId == modalId && $(this).is(":hidden")) { if(shownModalId == modalId && $(this).is(":hidden")) {
shownModalId = undefined; shownModalId = undefined;
Mousetrap.unpause(); $("#wmd-input").focus();
_.defer(function() {
$("#wmd-input").focus();
});
} }
}).keyup(function(e) { }).keyup(function(e) {
// Handle enter key in modals // Handle enter key in modals
@ -385,6 +383,11 @@ define([
} }
}); });
// Configure Mousetrap
mousetrap.stopCallback = function(e, element, combo) {
return shownModalId || $(element).is("input, select, textarea:not(#wmd-input)");
};
// Click events on "insert link" and "insert image" dialog buttons // Click events on "insert link" and "insert image" dialog buttons
$(".action-insert-link").click(function(e) { $(".action-insert-link").click(function(e) {
var value = utils.getInputTextValue($("#input-insert-link"), e); var value = utils.getInputTextValue($("#input-insert-link"), e);
@ -477,23 +480,7 @@ define([
container: '#modal-settings', container: '#modal-settings',
placement: 'right', placement: 'right',
trigger: 'manual', trigger: 'manual',
title: [ title: settingsTemplateTooltipHTML
'Available variables:<br>',
'<ul>',
' <li><b>documentTitle</b>: document title</li>',
' <li><b>documentMarkdown</b>: document in Markdown format</li>',
' <li><b>documentHTML</b>: document in HTML format</li>',
' <li><b>publishAttributes</b>: attributes of the publish location (undefined when using "Save")</li>',
'</ul>',
'Examples:<br />',
_.escape('<title><%= documentTitle %></title>'),
'<br />',
_.escape('<div><%- documentHTML %></div>'),
'<br />',
_.escape('<% if(publishAttributes.provider == "github") print(documentMarkdown); %>'),
'<br /><br />',
'<a target="_blank" href="http://underscorejs.org/#template">More info</a>',
].join("")
}).click(function(e) { }).click(function(e) {
$(this).tooltip('show'); $(this).tooltip('show');
$(document).on("click.tooltip-template", function(e) { $(document).on("click.tooltip-template", function(e) {

View File

@ -3,24 +3,27 @@ define([
"underscore", "underscore",
"utils", "utils",
"settings", "settings",
"extensions/button-sync", "text!html/settingsExtensionsAccordion.html",
"extensions/button-publish", "extensions/googleAnalytics",
"extensions/button-share", "extensions/buttonSync",
"extensions/button-stat", "extensions/buttonPublish",
"extensions/document-selector", "extensions/buttonShare",
"extensions/document-title", "extensions/buttonStat",
"extensions/manage-publication", "extensions/dialogAbout",
"extensions/manage-synchronization", "extensions/dialogManagePublication",
"extensions/working-indicator", "extensions/dialogManageSynchronization",
"extensions/documentSelector",
"extensions/documentTitle",
"extensions/workingIndicator",
"extensions/notifications", "extensions/notifications",
"extensions/markdown-extra", "extensions/markdown-extra",
"extensions/toc", "extensions/toc",
"extensions/math-jax", "extensions/mathJax",
"extensions/email-converter", "extensions/emailConverter",
"extensions/scroll-link", "extensions/scrollLink",
"libs/bootstrap", "libs/bootstrap",
"libs/jquery.waitforimages" "libs/jquery.waitforimages"
], function($, _, utils, settings) { ], function($, _, utils, settings, settingsExtensionsAccordionHTML) {
var extensionMgr = {}; var extensionMgr = {};
@ -139,24 +142,8 @@ define([
}); });
}; };
var accordionTmpl = [
'<div class="accordion-group">',
' <div class="accordion-heading">',
' <label class="checkbox pull-right">',
' <input id="input-enable-extension-<%= extensionId %>" type="checkbox" <% if(!optional) { %> disabled <% } %>> enabled',
' </label>',
' <a id="accordion-toggle-test" data-toggle="collapse" data-parent="#accordion-extensions" class="accordion-toggle" href="#collapse-<%= extensionId %>">',
' <%= extensionName %>',
' </a>',
' </div>',
' <div id="collapse-<%= extensionId %>" class="accordion-body collapse">',
' <div class="accordion-inner"><%= settingsBloc %></div>',
' </div>',
'</div>'
].join("");
function createSettings(extension) { function createSettings(extension) {
$("#accordion-extensions").append($(_.template(accordionTmpl, { $("#accordion-extensions").append($(_.template(settingsExtensionsAccordionHTML, {
extensionId: extension.extensionId, extensionId: extension.extensionId,
extensionName: extension.extensionName, extensionName: extension.extensionName,
optional: extension.optional, optional: extension.optional,

View File

@ -1,89 +0,0 @@
define([
"jquery",
"underscore",
"utils"
], function($, _, utils) {
var buttonStat = {
extensionId: "buttonStat",
extensionName: 'Button "Statistics"',
optional: true,
defaultConfig: {
name1: "Characters",
value1: "\\S",
name2: "Words",
value2: "\\S+",
name3: "Paragraphs",
value3: "\\S.*",
},
settingsBloc: [
'<p>Adds a "Document statistics" button in the navigation bar.</p>',
'<p><div class="form-inline">',
' <label class="label-text" for="input-stat-name1">Title</label>',
' <input id="input-stat-name1" type="text" class="input-small">',
' <label class="label-text" for="input-stat-value1">RegExp</label>',
' <input id="input-stat-value1" type="text" class="span2">',
'</div></p>',
'<p><div class="form-inline">',
' <label class="label-text" for="input-stat-name2">Title</label>',
' <input id="input-stat-name2" type="text" class="input-small">',
' <label class="label-text" for="input-stat-value2">RegExp</label>',
' <input id="input-stat-value2" type="text" class="span2">',
'</div></p>',
'<p><div class="form-inline">',
' <label class="label-text" for="input-stat-name3">Title</label>',
' <input id="input-stat-name3" type="text" class="input-small">',
' <label class="label-text" for="input-stat-value3">RegExp</label>',
' <input id="input-stat-value3" type="text" class="span2">',
'</div></p>'
].join("")
};
buttonStat.onLoadSettings = function() {
_.each([
1,
2,
3
], function(index) {
utils.setInputValue("#input-stat-name" + index, buttonStat.config["name" + index]);
utils.setInputValue("#input-stat-value" + index, buttonStat.config["value" + index]);
});
};
buttonStat.onSaveSettings = function(newConfig, event) {
_.each([
1,
2,
3
], function(index) {
newConfig["name" + index] = utils.getInputTextValue("#input-stat-name" + index, event);
newConfig["value" + index] = utils.getInputRegExpValue("#input-stat-value" + index, event);
});
};
buttonStat.onCreateButton = function() {
return $([
'<button class="btn dropdown-toggle" data-toggle="dropdown" title="Document statistics">',
' <i class="icon-stat"></i>',
'</button>',
'<div id="statistics-container" class="dropdown-menu pull-right">',
' <h3 class="muted">Statistics</h3>',
' <div class="stat">',
' <div>' + buttonStat.config.name1 + ': <span id="span-stat-value1"></span></div>',
' <div>' + buttonStat.config.name2 + ': <span id="span-stat-value2"></span></div>',
' <div>' + buttonStat.config.name3 + ': <span id="span-stat-value3"></span></div>',
' </div>',
'</div>'
].join(""));
};
buttonStat.onPreviewFinished = function() {
var text = $("#wmd-preview").clone().find("script").remove().end().text();
$("#span-stat-value1").text((text.match(new RegExp(buttonStat.config.value1, "g")) || []).length);
$("#span-stat-value2").text((text.match(new RegExp(buttonStat.config.value2, "g")) || []).length);
$("#span-stat-value3").text((text.match(new RegExp(buttonStat.config.value3, "g")) || []).length);
};
return buttonStat;
});

View File

@ -1,7 +1,8 @@
define([ define([
"jquery", "jquery",
"underscore" "underscore",
], function($, _) { "text!html/buttonPublish.html",
], function($, _, buttonPublishHTML) {
var buttonPublish = { var buttonPublish = {
extensionId: "buttonPublish", extensionId: "buttonPublish",
@ -34,11 +35,7 @@ define([
}; };
buttonPublish.onCreateButton = function() { buttonPublish.onCreateButton = function() {
button = $([ button = $(buttonPublishHTML).click(function() {
'<button class="btn" title="Publish this document">',
' <i class="icon-share"></i>',
'</button>'
].join("")).click(function() {
if(!$(this).hasClass("disabled")) { if(!$(this).hasClass("disabled")) {
publisher.publish(); publisher.publish();
} }

View File

@ -1,7 +1,9 @@
define([ define([
"jquery", "jquery",
"underscore" "underscore",
], function($, _) { "text!html/buttonShare.html",
"text!html/buttonShareLocation.html",
], function($, _, buttonShareHTML, buttonShareLocationHTML) {
var buttonShare = { var buttonShare = {
extensionId: "buttonShare", extensionId: "buttonShare",
@ -11,33 +13,10 @@ define([
}; };
buttonShare.onCreateButton = function() { buttonShare.onCreateButton = function() {
return $([ return $(buttonShareHTML);
'<button class="btn dropdown-toggle" data-toggle="dropdown" title="Share this document">',
' <i class="icon-link"></i>',
'</button>',
'<div id="link-container" class="dropdown-menu pull-right">',
' <h3 class="muted">Sharing</h3>',
' <div class="link-list"></div>',
' <p class="no-link">To share this document you need first to ',
' <a href="#" class="action-publish-gist">publish it as a Gist</a>',
' in Markdown format.',
' </p>',
' <blockquote class="muted">',
' <b>NOTE:</b> You can open any URL within StackEdit using',
' <a href="viewer.html?url=https://raw.github.com/benweet/stackedit/master/README.md"',
' title="Sharing example">viewer.html?url=...</a>',
' </blockquote>',
'</div>'
].join(""));
}; };
var fileDesc = undefined; var fileDesc = undefined;
var lineTemplate = [
'<div class="input-prepend">',
' <a href="<%= link %>" class="add-on" title="Sharing location"><i class="icon-link"></i></a>',
' <input class="span2" type="text" value="<%= link %>" readonly />',
'</div>'
].join("");
var refreshDocumentSharing = function(fileDescParameter) { var refreshDocumentSharing = function(fileDescParameter) {
if(fileDescParameter !== undefined && fileDescParameter !== fileDesc) { if(fileDescParameter !== undefined && fileDescParameter !== fileDesc) {
return; return;
@ -49,7 +28,7 @@ define([
var attributesList = _.values(fileDesc.publishLocations); var attributesList = _.values(fileDesc.publishLocations);
_.each(attributesList, function(attributes) { _.each(attributesList, function(attributes) {
if(attributes.sharingLink) { if(attributes.sharingLink) {
var lineElement = $(_.template(lineTemplate, { var lineElement = $(_.template(buttonShareLocationHTML, {
link: attributes.sharingLink link: attributes.sharingLink
})); }));
lineElement.click(function(event) { lineElement.click(function(event) {

View File

@ -0,0 +1,59 @@
define([
"jquery",
"underscore",
"utils",
"text!html/buttonStat.html",
"text!html/buttonStatSettingsBloc.html",
], function($, _, utils, buttonStatHTML, buttonStatSettingsBlocHTML) {
var buttonStat = {
extensionId: "buttonStat",
extensionName: 'Button "Statistics"',
optional: true,
defaultConfig: {
name1: "Characters",
value1: "\\S",
name2: "Words",
value2: "\\S+",
name3: "Paragraphs",
value3: "\\S.*",
},
settingsBloc: buttonStatSettingsBlocHTML
};
buttonStat.onLoadSettings = function() {
_.each([
1,
2,
3
], function(index) {
utils.setInputValue("#input-stat-name" + index, buttonStat.config["name" + index]);
utils.setInputValue("#input-stat-value" + index, buttonStat.config["value" + index]);
});
};
buttonStat.onSaveSettings = function(newConfig, event) {
_.each([
1,
2,
3
], function(index) {
newConfig["name" + index] = utils.getInputTextValue("#input-stat-name" + index, event);
newConfig["value" + index] = utils.getInputRegExpValue("#input-stat-value" + index, event);
});
};
buttonStat.onCreateButton = function() {
return $(_.template(buttonStatHTML, buttonStat.config));
};
buttonStat.onPreviewFinished = function() {
var text = $("#wmd-preview").clone().find("script").remove().end().text();
$("#span-stat-value1").text((text.match(new RegExp(buttonStat.config.value1, "g")) || []).length);
$("#span-stat-value2").text((text.match(new RegExp(buttonStat.config.value2, "g")) || []).length);
$("#span-stat-value3").text((text.match(new RegExp(buttonStat.config.value3, "g")) || []).length);
};
return buttonStat;
});

View File

@ -1,7 +1,8 @@
define([ define([
"jquery", "jquery",
"underscore" "underscore",
], function($, _) { "text!html/buttonSync.html",
], function($, _, buttonSyncHTML) {
var buttonSync = { var buttonSync = {
extensionId: "buttonSync", extensionId: "buttonSync",
@ -32,11 +33,7 @@ define([
}; };
buttonSync.onCreateButton = function() { buttonSync.onCreateButton = function() {
button = $([ button = $(buttonSyncHTML).click(function() {
'<button class="btn" title="Synchronize all documents">',
' <i class="icon-refresh"></i>',
'</button>'
].join("")).click(function() {
if(!$(this).hasClass("disabled")) { if(!$(this).hasClass("disabled")) {
synchronizer.forceSync(); synchronizer.forceSync();
} }

View File

@ -0,0 +1,50 @@
define([
"jquery",
"underscore",
"text!html/dialogAbout.html",
], function($, _, dialogAboutHTML) {
var dialogAbout = {
extensionId: "dialogAbout",
extensionName: 'Dialog "About"',
settingsBloc: '<p>Prints the content of the "About" dialog box.</p>'
};
var libraries = {
"Bootstrap": "http://twitter.github.io/bootstrap/",
"CSS Browser Selector": "https://github.com/rafaelp/css_browser_selector/",
"Dropbox-js": "https://github.com/dropbox/dropbox-js",
"FileSaver.js": "https://github.com/eligrey/FileSaver.js/",
"Gatekeeper": "https://github.com/prose/gatekeeper",
"Github.js": "https://github.com/michael/github",
"Glyphicons": "http://glyphicons.com/",
"jGrowl": "https://github.com/stanlemon/jGrowl/",
"jQuery": "http://jquery.com/",
"jQuery Mouse Wheel Plugin": "https://github.com/brandonaaron/jquery-mousewheel",
"Mousetrap": "http://craig.is/killing/mice",
"PageDown": "https://code.google.com/p/pagedown/",
"Pagedown-extra": "https://github.com/jmcmanus/pagedown-extra/",
"Prettify": "https://code.google.com/p/google-code-prettify/",
"RequireJS": "http://requirejs.org/",
"UI Layout": "http://layout.jquery-dev.net/",
"Underscore.js": "http://underscorejs.org/",
"waitForImages": "https://github.com/alexanderdickson/waitForImages"
};
var projects = {
"StackEdit Download Proxy": "https://github.com/benweet/stackedit-download-proxy",
"StackEdit SSH Proxy": "https://github.com/benweet/stackedit-ssh-proxy",
"StackEdit Tumblr Proxy": "https://github.com/benweet/stackedit-tumblr-proxy",
"StackEdit WordPress Proxy": "https://github.com/benweet/stackedit-wordpress-proxy",
};
dialogAbout.onReady = function() {
$("#modal-about .modal-body").html(_.template(dialogAboutHTML, {
libraries: libraries,
projects: projects
}));
};
return dialogAbout;
});

View File

@ -1,28 +1,21 @@
define([ define([
"jquery", "jquery",
"underscore" "underscore",
], function($, _) { "text!html/dialogManagePublicationLocation.html",
], function($, _, dialogManagePublicationLocationHTML) {
var managePublication = { var dialogManagePublication = {
extensionId: "managePublication", extensionId: "dialogManagePublication",
extensionName: "Manage publication", extensionName: 'Dialog "Manage publication"',
settingsBloc: '<p>Populates the "Manage publication" dialog box.</p>' settingsBloc: '<p>Populates the "Manage publication" dialog box.</p>'
}; };
var fileMgr = undefined; var fileMgr = undefined;
managePublication.onFileMgrCreated = function(fileMgrParameter) { dialogManagePublication.onFileMgrCreated = function(fileMgrParameter) {
fileMgr = fileMgrParameter; fileMgr = fileMgrParameter;
}; };
var fileDesc = undefined; var fileDesc = undefined;
var lineTemplate = [
'<div class="input-prepend input-append">',
' <span class="add-on" title="<%= provider.providerName %>">',
' <i class="icon-<%= provider.providerId %>"></i>',
' </span>',
' <input class="span5" type="text" value="<%= publishDesc %>" disabled />',
'</div>'
].join("");
var removeButtonTemplate = '<a class="btn" title="Remove this location"><i class="icon-trash"></i></a>'; var removeButtonTemplate = '<a class="btn" title="Remove this location"><i class="icon-trash"></i></a>';
var refreshDialog = function(fileDescParameter) { var refreshDialog = function(fileDescParameter) {
if(fileDescParameter !== undefined && fileDescParameter !== fileDesc) { if(fileDescParameter !== undefined && fileDescParameter !== fileDesc) {
@ -44,7 +37,7 @@ define([
formattedAttributes.password = "********"; formattedAttributes.password = "********";
} }
var publishDesc = JSON.stringify(formattedAttributes).replace(/{|}|"/g, "").replace(/,/g, ", "); var publishDesc = JSON.stringify(formattedAttributes).replace(/{|}|"/g, "").replace(/,/g, ", ");
var lineElement = $(_.template(lineTemplate, { var lineElement = $(_.template(dialogManagePublicationLocationHTML, {
provider: publishAttributes.provider, provider: publishAttributes.provider,
publishDesc: publishDesc publishDesc: publishDesc
})); }));
@ -55,14 +48,14 @@ define([
}); });
}; };
managePublication.onFileSelected = function(fileDescParameter) { dialogManagePublication.onFileSelected = function(fileDescParameter) {
fileDesc = fileDescParameter; fileDesc = fileDescParameter;
refreshDialog(fileDescParameter); refreshDialog(fileDescParameter);
}; };
managePublication.onNewPublishSuccess = refreshDialog; dialogManagePublication.onNewPublishSuccess = refreshDialog;
managePublication.onPublishRemoved = refreshDialog; dialogManagePublication.onPublishRemoved = refreshDialog;
return managePublication; return dialogManagePublication;
}); });

View File

@ -1,28 +1,21 @@
define([ define([
"jquery", "jquery",
"underscore" "underscore",
], function($, _) { "text!html/dialogManageSynchronizationLocation.html",
], function($, _, dialogManageSynchronizationLocationHTML) {
var manageSynchronization = { var dialogManageSynchronization = {
extensionId: "manageSynchronization", extensionId: "dialogManageSynchronization",
extensionName: "Manage synchronization", extensionName: 'Dialog "Manage synchronization"',
settingsBloc: '<p>Populates the "Manage synchronization" dialog box.</p>' settingsBloc: '<p>Populates the "Manage synchronization" dialog box.</p>'
}; };
var fileMgr = undefined; var fileMgr = undefined;
manageSynchronization.onFileMgrCreated = function(fileMgrParameter) { dialogManageSynchronization.onFileMgrCreated = function(fileMgrParameter) {
fileMgr = fileMgrParameter; fileMgr = fileMgrParameter;
}; };
var fileDesc = undefined; var fileDesc = undefined;
var lineTemplate = [
'<div class="input-prepend input-append">',
' <span class="add-on" title="<%= provider.providerName %>">',
' <i class="icon-<%= provider.providerId %>"></i>',
' </span>',
' <input class="span5" type="text" value="<%= syncDesc %>" disabled />',
'</div>'
].join("");
var removeButtonTemplate = '<a class="btn" title="Remove this location"><i class="icon-trash"></i></a>'; var removeButtonTemplate = '<a class="btn" title="Remove this location"><i class="icon-trash"></i></a>';
var refreshDialog = function(fileDescParameter) { var refreshDialog = function(fileDescParameter) {
if(fileDescParameter !== undefined && fileDescParameter !== fileDesc) { if(fileDescParameter !== undefined && fileDescParameter !== fileDesc) {
@ -40,7 +33,7 @@ define([
} }
_.each(syncAttributesList, function(syncAttributes) { _.each(syncAttributesList, function(syncAttributes) {
var syncDesc = syncAttributes.id || syncAttributes.path; var syncDesc = syncAttributes.id || syncAttributes.path;
var lineElement = $(_.template(lineTemplate, { var lineElement = $(_.template(dialogManageSynchronizationLocationHTML, {
provider: syncAttributes.provider, provider: syncAttributes.provider,
syncDesc: syncDesc syncDesc: syncDesc
})); }));
@ -51,15 +44,15 @@ define([
}); });
}; };
manageSynchronization.onFileSelected = function(fileDescParameter) { dialogManageSynchronization.onFileSelected = function(fileDescParameter) {
fileDesc = fileDescParameter; fileDesc = fileDescParameter;
refreshDialog(fileDescParameter); refreshDialog(fileDescParameter);
}; };
manageSynchronization.onSyncExportSuccess = refreshDialog; dialogManageSynchronization.onSyncExportSuccess = refreshDialog;
manageSynchronization.onSyncRemoved = refreshDialog; dialogManageSynchronization.onSyncRemoved = refreshDialog;
manageSynchronization.onReady = function() { dialogManageSynchronization.onReady = function() {
// Handle enter key in the sync manual inputs // Handle enter key in the sync manual inputs
$(".sync-manual").each(function() { $(".sync-manual").each(function() {
var elt = $(this); var elt = $(this);
@ -72,6 +65,6 @@ define([
}); });
}; };
return manageSynchronization; return dialogManageSynchronization;
}); });

View File

@ -1,19 +1,33 @@
define([ define([
"jquery", "jquery",
"underscore", "underscore",
"file-system", "utils",
"libs/mousetrap", "mousetrap",
], function($, _, fileSystem) { "fileSystem",
"text!html/documentSelectorSettingsBloc.html",
], function($, _, utils, mousetrap, fileSystem, documentSelectorSettingsBlocHTML) {
var documentSelector = { var documentSelector = {
extensionId: "documentSelector", extensionId: "documentSelector",
extensionName: "Document selector", extensionName: "Document Selector",
defaultConfig: { defaultConfig: {
sortBy: "mru", orderBy: "title",
keyPrevious: "[", shortcutPrevious: "Ctrl+[",
keyNext: "]" shortcutNext: "Ctrl+]"
}, },
settingsBloc: '<p>Builds the "Open document" dropdown menu.</p>' settingsBloc: documentSelectorSettingsBlocHTML
};
documentSelector.onLoadSettings = function() {
utils.setInputValue("#select-document-selector-orderby", documentSelector.config.sortBy);
utils.setInputValue("#input-document-selector-shortcut-previous", documentSelector.config.shortcutPrevious);
utils.setInputValue("#input-document-selector-shortcut-next", documentSelector.config.shortcutNext);
};
documentSelector.onSaveSettings = function(newConfig, event) {
newConfig.orderBy = utils.getInputValue("#select-document-selector-orderby");
newConfig.shortcutPrevious = utils.getInputTextValue("#input-document-selector-shortcut-previous", event);
newConfig.shortcutNext = utils.getInputTextValue("#input-document-selector-shortcut-next", event);
}; };
var fileMgr = undefined; var fileMgr = undefined;
@ -48,6 +62,9 @@ define([
if(!liMap[fileDesc.fileIndex].is(".disabled")) { if(!liMap[fileDesc.fileIndex].is(".disabled")) {
fileMgr.selectFile(fileDesc); fileMgr.selectFile(fileDesc);
} }
else {
$("#wmd-input").focus();
}
}); });
var li = $("<li>").append(a); var li = $("<li>").append(a);
liMap[fileDesc.fileIndex] = li; liMap[fileDesc.fileIndex] = li;
@ -96,30 +113,34 @@ define([
} }
documentSelector.onReady = function() { documentSelector.onReady = function() {
if(documentSelector.config.sortBy == "title") { if(documentSelector.config.orderBy == "title") {
sortFunction = function(fileDesc) { sortFunction = function(fileDesc) {
return fileDesc.title.toLowerCase(); return fileDesc.title.toLowerCase();
}; };
} }
else if(documentSelector.config.sortBy == "mru") { else if(documentSelector.config.orderBy == "mru") {
sortFunction = function(fileDesc) { sortFunction = function(fileDesc) {
return -fileDesc.selectTime; return -fileDesc.selectTime;
}; };
} }
var shortcutClick = false; var shortcutLi = undefined;
$(".action-open-file").click(function() { $(".action-open-file").click(function() {
if($("#file-selector:parent").is(".open")) { if($("#file-selector").parent().is(".open")) {
return; return;
} }
filterFileSelector(); filterFileSelector();
if(shortcutClick === true) { if(shortcutLi !== undefined) {
return; return;
} }
_.defer(function() { _.defer(function() {
$("#file-search").val("").focus(); $("#file-search").val("").focus();
}); });
}); }).prop("title", _.template("<%= title %> <%= shortcutPrevious %> <%= shortcutNext %>", {
title: $(".action-open-file").prop("title"),
shortcutPrevious: documentSelector.config.shortcutPrevious,
shortcutNext: documentSelector.config.shortcutNext
}));
$("#file-search").keyup(function(e) { $("#file-search").keyup(function(e) {
if(e.which == 13 || e.which == 27) { if(e.which == 13 || e.which == 27) {
$(this).parent().click(); $(this).parent().click();
@ -132,11 +153,9 @@ define([
}); });
// Handle key shortcut // Handle key shortcut
var shortcutLi = undefined; mousetrap.bind(documentSelector.config.shortcutPrevious.toLowerCase(), function() {
Mousetrap.bind('ctrl+' + documentSelector.config.keyPrevious, function() {
shortcutClick = true;
if(shortcutLi === undefined) { if(shortcutLi === undefined) {
$(".action-open-file").click(); $("#file-selector").parent().is(".open") || $(".action-open-file").click();
shortcutLi = liMap[selectFileDesc.fileIndex]; shortcutLi = liMap[selectFileDesc.fileIndex];
} }
var liIndex = _.indexOf(liArray, shortcutLi) - 1; var liIndex = _.indexOf(liArray, shortcutLi) - 1;
@ -149,10 +168,9 @@ define([
}); });
return false; return false;
}); });
Mousetrap.bind('ctrl+' + documentSelector.config.keyNext, function() { mousetrap.bind(documentSelector.config.shortcutNext.toLowerCase(), function() {
shortcutClick = true;
if(shortcutLi === undefined) { if(shortcutLi === undefined) {
$(".action-open-file").click(); $("#file-selector").parent().is(".open") || $(".action-open-file").click();
shortcutLi = liMap[selectFileDesc.fileIndex]; shortcutLi = liMap[selectFileDesc.fileIndex];
} }
var liIndex = _.indexOf(liArray, shortcutLi) + 1; var liIndex = _.indexOf(liArray, shortcutLi) + 1;
@ -162,8 +180,7 @@ define([
}); });
return false; return false;
}); });
Mousetrap.bind('ctrl', function() { mousetrap.bind('ctrl', function() {
shortcutClick = false;
if(shortcutLi !== undefined) { if(shortcutLi !== undefined) {
shortcutLi.find("a").click(); shortcutLi.find("a").click();
shortcutLi = undefined; shortcutLi = undefined;

View File

@ -5,7 +5,7 @@ define([
var documentTitle = { var documentTitle = {
extensionId: "documentTitle", extensionId: "documentTitle",
extensionName: "Document title", extensionName: "Document Title",
settingsBloc: '<p>Responsible for showing the document title in the navigation bar.</p>' settingsBloc: '<p>Responsible for showing the document title in the navigation bar.</p>'
}; };

View File

@ -0,0 +1,190 @@
define([
"jquery",
"underscore",
"settings",
"config",
], function($, _, settings) {
var googleAnalytics = {
extensionId: "googleAnalytics",
extensionName: 'Google Analytics',
optional: true,
settingsBloc: '<p>Sends anonymous statistics about usage and errors to help improve StackEdit.</p>'
};
var isLoaded = false;
var isOffline = false;
window["_gaq"] = [];
var init = function() {
if(isLoaded === false && isOffline === false) {
// First configure GA
_gaq.push([
'_setAccount',
GOOGLE_ANALYTICS_ACCOUNT_ID
]);
_gaq.push([
'_trackPageview'
]);
// Collect informations about user settings
_gaq.push([
'_trackEvent',
"settings",
'layoutOrientation',
"" + settings.layoutOrientation
]);
_gaq.push([
'_trackEvent',
"settings",
'lazyRendering',
"" + settings.lazyRendering
]);
_gaq.push([
'_trackEvent',
"settings",
'editorFontSize',
"" + settings.editorFontSize
]);
// Check if user has removed back links
_gaq.push([
'_trackEvent',
"settings",
'defaultContentBacklink',
"" + settings.defaultContent.indexOf(MAIN_URL) >= 0
]);
_gaq.push([
'_trackEvent',
"settings",
'commitMsgBacklink',
"" + settings.commitMsg.indexOf(MAIN_URL) >= 0
]);
// Check if user has changed sshProxy
_gaq.push([
'_trackEvent',
"settings",
'sshProxyChanged',
"" + settings.sshProxy != SSH_PROXY_URL
]);
// Check if extensions have been disabled
_.each(settings.extensionSettings, function(config, extensionId) {
_gaq.push([
'_trackEvent',
"extensions",
extensionId + "Enabled",
"" + config.enabled
]);
});
// Now load GA script using jQuery
var gaUrl = "/ga.js";
if(location.search.match(/(\?|&)console/)) {
gaUrl = "/u/ga_debug.js";
}
$.ajax({
url: "http://www.google-analytics.com" + gaUrl,
dataType: "script"
}).done(function() {
isLoaded = true;
});
}
};
googleAnalytics.onReady = init;
googleAnalytics.onOfflineChanged = function(isOfflineParam) {
isOffline = isOfflineParam;
init();
};
var currentAction = "No action";
googleAnalytics.onSyncRunning = function() {
currentAction = "Sync";
};
googleAnalytics.onPublishRunning = function() {
currentAction = "Publish";
};
googleAnalytics.onAsyncRunning = function(isRunning) {
if(isRunning === false) {
currentAction = "No action";
}
};
// Log sync frequency
googleAnalytics.onSyncSuccess = function() {
_gaq.push([
'_trackEvent',
'Sync',
'SyncSuccess'
]);
};
// Log import frequency and provider
googleAnalytics.onSyncImportSuccess = function(fileDescList, provider) {
_gaq.push([
'_trackEvent',
'Sync',
'SyncImport',
]);
_gaq.push([
'_trackEvent',
'Sync',
'SyncImportProvider',
provider.providerId
]);
};
// Log export frequency and provider
googleAnalytics.onSyncExportSuccess = function(fileDesc, syncAttributes) {
_gaq.push([
'_trackEvent',
'Sync',
'SyncExport',
]);
_gaq.push([
'_trackEvent',
'Sync',
'SyncExportProvider',
syncAttributes.provider.providerId
]);
};
// Log publish frequency and provider
googleAnalytics.onPublishSuccess = function(fileDesc) {
_gaq.push([
'_trackEvent',
'Publish',
'PublishSuccess'
]);
_.each(fileDesc.publishLocations, function(publishAttributes) {
_gaq.push([
'_trackEvent',
'Publish',
'PublishSuccessProvider',
publishAttributes.provider.providerId
]);
});
};
// Log new publication's provider
googleAnalytics.onNewPublishSuccess = function(fileDesc, publishAttributes) {
_gaq.push([
'_trackEvent',
'Publish',
'NewPublishProvider',
publishAttributes.provider.providerId
]);
};
// Log error messages
googleAnalytics.onError = function(error) {
if(_.isString(error) || !error.message) {
return;
}
_gaq.push([
'_trackEvent',
currentAction,
'Error',
error.message
]);
};
return googleAnalytics;
});

View File

@ -1,7 +1,8 @@
define([ define([
"utils", "utils",
"libs/Markdown.Extra" "text!html/markdownExtraSettingsBloc.html",
], function(utils) { "libs/Markdown.Extra",
], function(utils, markdownExtraSettingsBlocHTML) {
var markdownExtra = { var markdownExtra = {
extensionId: "markdownExtra", extensionId: "markdownExtra",
@ -10,17 +11,7 @@ define([
defaultConfig: { defaultConfig: {
prettify: true prettify: true
}, },
settingsBloc: [ settingsBloc: markdownExtraSettingsBlocHTML
'<p>Adds extra features to the original Markdown syntax.</p>',
'<div class="form-horizontal">',
' <div class="control-group">',
' <label class="control-label" for="input-markdownextra-prettify">Prettify syntax highlighting</label>',
' <div class="controls">',
' <input type="checkbox" id="input-markdownextra-prettify">',
' </div>',
' </div>',
'</div>'
].join("")
}; };
markdownExtra.onLoadSettings = function() { markdownExtra.onLoadSettings = function() {

View File

@ -2,8 +2,9 @@ define([
"jquery", "jquery",
"underscore", "underscore",
"utils", "utils",
"jgrowl" "jgrowl",
], function($, _, utils, jGrowl) { "text!html/notificationsSettingsBloc.html",
], function($, _, utils, jGrowl, notificationsSettingsBlocHTML) {
var notifications = { var notifications = {
extensionId: "notifications", extensionId: "notifications",
@ -11,18 +12,7 @@ define([
defaultConfig: { defaultConfig: {
timeout: 8000 timeout: 8000
}, },
settingsBloc: [ settingsBloc: notificationsSettingsBlocHTML
'<p>Shows notification messages in the bottom-right corner of the screen.</p>',
'<div class="form-horizontal">',
' <div class="control-group">',
' <label class="control-label" for="input-notifications-timeout">Timeout</label>',
' <div class="controls">',
' <input type="text" id="input-notifications-timeout" class="input-mini">',
' <span class="help-inline">ms</span>',
' </div>',
' </div>',
'</div>'
].join("")
}; };
notifications.onLoadSettings = function() { notifications.onLoadSettings = function() {

View File

@ -1,21 +1,16 @@
define([ define([
"jquery", "jquery",
"underscore", "underscore",
"text!html/scrollLinkSettingsBloc.html",
"libs/css_browser_selector", "libs/css_browser_selector",
"libs/jquery.mousewheel" "libs/jquery.mousewheel"
], function($, _) { ], function($, _, scrollLinkSettingsBlocHTML) {
var scrollLink = { var scrollLink = {
extensionId: "scrollLink", extensionId: "scrollLink",
extensionName: "Scroll Link", extensionName: "Scroll Link",
optional: true, optional: true,
settingsBloc: [ settingsBloc: scrollLinkSettingsBlocHTML
'<p>Binds together editor and preview scrollbars.</p>',
'<blockquote class="muted"><b>NOTE:</b>',
' The mapping between Markdown and HTML is based on the position of the title elements (h1, h2, ...) in the page.',
' Therefore, if your document does not contain any title, the mapping will be linear and consequently less accurate.',
'</bloquote>'
].join("")
}; };
var mdSectionList = []; var mdSectionList = [];

View File

@ -1,8 +1,9 @@
define([ define([
"jquery", "jquery",
"underscore", "underscore",
"utils" "utils",
], function($, _, utils) { "text!html/tocSettingsBloc.html",
], function($, _, utils, tocSettingsBlocHTML) {
var toc = { var toc = {
extensionId: "toc", extensionId: "toc",
@ -11,17 +12,7 @@ define([
defaultConfig: { defaultConfig: {
marker: "\\[(TOC|toc)\\]" marker: "\\[(TOC|toc)\\]"
}, },
settingsBloc: [ settingsBloc: tocSettingsBlocHTML
'<p>Generates a table of content when a [TOC] marker is found.</p>',
'<div class="form-horizontal">',
' <div class="control-group">',
' <label class="control-label" for="input-toc-marker">Marker RegExp</label>',
' <div class="controls">',
' <input type="text" id="input-toc-marker" class="span2">',
' </div>',
' </div>',
'</div>'
].join("")
}; };
toc.onLoadSettings = function() { toc.onLoadSettings = function() {

View File

@ -4,9 +4,9 @@ define([
"core", "core",
"utils", "utils",
"settings", "settings",
"extension-manager", "extensionMgr",
"file-system", "fileSystem",
"libs/text!../WELCOME.md" "text!../WELCOME.md"
], function($, _, core, utils, settings, extensionMgr, fileSystem, welcomeContent) { ], function($, _, core, utils, settings, extensionMgr, fileSystem, welcomeContent) {
var fileMgr = {}; var fileMgr = {};

View File

@ -2,8 +2,8 @@ define([
"jquery", "jquery",
"underscore", "underscore",
"core", "core",
"extension-manager", "extensionMgr",
"async-runner" "asyncRunner"
], function($, _, core, extensionMgr, asyncRunner) { ], function($, _, core, extensionMgr, asyncRunner) {
var client = undefined; var client = undefined;

View File

@ -2,8 +2,8 @@ define([
"jquery", "jquery",
"core", "core",
"utils", "utils",
"extension-manager", "extensionMgr",
"async-runner" "asyncRunner"
], function($, core, utils, extensionMgr, asyncRunner) { ], function($, core, utils, extensionMgr, asyncRunner) {
var connected = undefined; var connected = undefined;

View File

@ -2,8 +2,8 @@ define([
"jquery", "jquery",
"core", "core",
"utils", "utils",
"extension-manager", "extensionMgr",
"async-runner" "asyncRunner"
], function($, core, utils, extensionMgr, asyncRunner) { ], function($, core, utils, extensionMgr, asyncRunner) {
var connected = false; var connected = false;

View File

@ -1,7 +1,7 @@
define([ define([
"jquery", "jquery",
"core", "core",
"async-runner" "asyncRunner"
], function($, core, asyncRunner) { ], function($, core, asyncRunner) {
var sshHelper = {}; var sshHelper = {};

View File

@ -2,8 +2,8 @@ define([
"jquery", "jquery",
"core", "core",
"utils", "utils",
"extension-manager", "extensionMgr",
"async-runner" "asyncRunner"
], function($, core, utils, extensionMgr, asyncRunner) { ], function($, core, utils, extensionMgr, asyncRunner) {
var oauthParams = undefined; var oauthParams = undefined;

View File

@ -2,8 +2,8 @@ define([
"jquery", "jquery",
"core", "core",
"utils", "utils",
"extension-manager", "extensionMgr",
"async-runner" "asyncRunner"
], function($, core, utils, extensionMgr, asyncRunner) { ], function($, core, utils, extensionMgr, asyncRunner) {
var token = undefined; var token = undefined;

View File

@ -0,0 +1,3 @@
<button class="btn" title="Publish this document">
<i class="icon-share"></i>
</button>

17
js/html/buttonShare.html Normal file
View File

@ -0,0 +1,17 @@
<button class="btn dropdown-toggle" data-toggle="dropdown"
title="Share this document">
<i class="icon-link"></i>
</button>
<div id="link-container" class="dropdown-menu pull-right">
<h3 class="muted">Sharing</h3>
<div class="link-list"></div>
<p class="no-link">To share this document you need first to <a
href="#" class="action-publish-gist">publish it as a Gist</a> in
Markdown format.
</p>
<blockquote class="muted">
<b>NOTE:</b> You can open any URL within StackEdit using <a
href="viewer.html?url=https://raw.github.com/benweet/stackedit/master/README.md"
title="Sharing example">viewer.html?url=...</a>
</blockquote>
</div>

View File

@ -0,0 +1,5 @@
<div class="input-prepend">
<a href="<%= link %>" class="add-on" title="Sharing location"><i
class="icon-link"></i></a> <input class="span2" type="text"
value="<%= link %>" readonly />
</div>

18
js/html/buttonStat.html Normal file
View File

@ -0,0 +1,18 @@
<button class="btn dropdown-toggle" data-toggle="dropdown"
title="Document's statistics">
<i class="icon-stat"></i>
</button>
<div id="statistics-container" class="dropdown-menu pull-right">
<h3 class="muted">Statistics</h3>
<div class="stat">
<div>
<%= name1 %>: <span id="span-stat-value1"></span>
</div>
<div>
<%= name2 %>: <span id="span-stat-value2"></span>
</div>
<div>
<%= name3 %>: <span id="span-stat-value3"></span>
</div>
</div>
</div>

View File

@ -0,0 +1,21 @@
<p>Adds a "Document's statistics" button in the navigation bar.</p>
<div class="form-horizontal">
<div class="control-group form-inline">
<label class="label-text" for="input-stat-name1">Title</label> <input
id="input-stat-name1" type="text" class="input-small"> <label
class="label-text" for="input-stat-value1">RegExp</label> <input
id="input-stat-value1" type="text" class="span2">
</div>
<div class="control-group form-inline">
<label class="label-text" for="input-stat-name2">Title</label> <input
id="input-stat-name2" type="text" class="input-small"> <label
class="label-text" for="input-stat-value2">RegExp</label> <input
id="input-stat-value2" type="text" class="span2">
</div>
<div class="control-group form-inline">
<label class="label-text" for="input-stat-name3">Title</label> <input
id="input-stat-name3" type="text" class="input-small"> <label
class="label-text" for="input-stat-value3">RegExp</label> <input
id="input-stat-value3" type="text" class="span2">
</div>
</div>

3
js/html/buttonSync.html Normal file
View File

@ -0,0 +1,3 @@
<button class="btn" title="Synchronize all documents">
<i class="icon-refresh"></i>
</button>

56
js/html/dialogAbout.html Normal file
View File

@ -0,0 +1,56 @@
<dl>
<dt>About:</dt>
<dd>
<a target="_blank" href="https://github.com/benweet/stackedit/">GitHub
page</a> / <a target="_blank"
href="https://github.com/benweet/stackedit/issues">issue tracker</a>
</dd>
<dd>
<a target="_blank"
href="https://chrome.google.com/webstore/detail/stackedit/iiooodelglhkcpgbajoejffhijaclcdg">Chrome
app</a> (thanks for your review!)
</dd>
<dd>
<a target="_blank" href="https://twitter.com/stackedit/">Follow on
Twitter</a>
</dd>
<dd>
<a target="_blank" href="https://www.facebook.com/stackedit/">Follow
on Facebook</a>
</dd>
<dd>
<a target="_blank"
href="https://plus.google.com/110816046787593496375" rel="publisher">Follow
on Google+</a>
</dd>
</dl>
<dl>
<dt>Developers:</dt>
<dd>
<a target="_blank" href="http://www.benoitschweblin.com">Benoit
Schweblin</a><br />
</dd>
<dd>Pete Eigel (contributor)
</dd>
</dl>
<dl>
<dt>Credit:</dt>
<% _.each(libraries, function(url, name) { %>
<dd>
<a target="_blank" href="<%= url %>"><%= name %></a>
</dd>
<% }); %>
</dl>
<dl>
<dt>Related projects:</dt>
<% _.each(projects, function(url, name) { %>
<dd>
<a target="_blank" href="<%= url %>"><%= name %></a>
</dd>
<% }); %>
</dl>
<p>Copyright 2013 <a target="_blank"
href="http://www.benoitschweblin.com">Benoit Schweblin</a><br />
Licensed under an <a target="_blank"
href="http://www.apache.org/licenses/LICENSE-2.0">Apache License</a></p>

View File

@ -0,0 +1,5 @@
<div class="input-prepend input-append">
<span class="add-on" title="<%= provider.providerName %>"> <i
class="icon-<%= provider.providerId %>"></i>
</span> <input class="span5" type="text" value="<%= publishDesc %>" disabled />
</div>

View File

@ -0,0 +1,5 @@
<div class="input-prepend input-append">
<span class="add-on" title="<%= provider.providerName %>"> <i
class="icon-<%= provider.providerId %>"></i>
</span> <input class="span5" type="text" value="<%= syncDesc %>" disabled />
</div>

View File

@ -0,0 +1,31 @@
<p>Builds the "Open document" dropdown menu.</p>
<div class="form-horizontal">
<div class="control-group">
<label class="control-label" for="select-document-selector-orderby">Order
by</label>
<div class="controls">
<select id="select-document-selector-orderby">
<option value="title">Document title</option>
<option value="mru">Most recently used</option>
</select>
</div>
</div>
<div class="control-group">
<label class="control-label"
for="input-document-selector-shortcut-previous">"Previous"
shortcut <a href="http://craig.is/killing/mice#keys" target="_blank">(?)</a></label>
<div class="controls">
<input type="text" id="input-document-selector-shortcut-previous"
class="span2">
</div>
</div>
<div class="control-group">
<label class="control-label"
for="input-document-selector-shortcut-next">"Next"
shortcut <a href="http://craig.is/killing/mice#keys" target="_blank">(?)</a></label>
<div class="controls">
<input type="text" id="input-document-selector-shortcut-next"
class="span2">
</div>
</div>
</div>

View File

@ -0,0 +1,10 @@
<p>Adds extra features to the original Markdown syntax.</p>
<div class="form-horizontal">
<div class="control-group">
<label class="control-label" for="input-markdownextra-prettify">Prettify
syntax highlighting</label>
<div class="controls">
<input type="checkbox" id="input-markdownextra-prettify">
</div>
</div>
</div>

View File

@ -0,0 +1,11 @@
<p>Shows notification messages in the bottom-right corner of the
screen.</p>
<div class="form-horizontal">
<div class="control-group">
<label class="control-label" for="input-notifications-timeout">Timeout</label>
<div class="controls">
<input type="text" id="input-notifications-timeout"
class="input-mini"> <span class="help-inline">ms</span>
</div>
</div>
</div>

View File

@ -0,0 +1,7 @@
<p>Binds together editor and preview scrollbars.</p>
<blockquote class="muted">
<b>NOTE:</b> The mapping between Markdown and HTML is based on the
position of the title elements (h1 h2 ...) in the page. Therefore if
your document does not contain any title the mapping will be linear and
consequently less accurate.
</blockquote>

View File

@ -0,0 +1,13 @@
<div class="accordion-group">
<div class="accordion-heading">
<label class="checkbox pull-right"> <input
id="input-enable-extension-<%= extensionId %>" type="checkbox"<%
if(!optional) print('disabled') %>> enabled
</label> <a data-toggle="collapse"
data-parent="#accordion-extensions" class="accordion-toggle"
href="#collapse-<%= extensionId %>"> <%= extensionName %> </a>
</div>
<div id="collapse-<%= extensionId %>" class="accordion-body collapse">
<div class="accordion-inner"><%= settingsBloc %></div>
</div>
</div>

View File

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>&lt;%= documentTitle %&gt;</title>
<link rel="stylesheet"
href="<%= siteUrl %>css/main-min.css" />
</head>
<body>&lt;%= documentHTML %&gt;
</body>
</html>

View File

@ -0,0 +1,21 @@
Available variables:
<br>
<ul>
<li><b>documentTitle</b>: document title</li>
<li><b>documentMarkdown</b>: document in Markdown format</li>
<li><b>documentHTML</b>: document in HTML format</li>
<li><b>publishAttributes</b>: attributes of the publish location
(undefined when using "Save")</li>
</ul>
Examples:
<br />
&lt;title&gt;&lt;%= documentTitle %&gt;&lt;&#x2F;title&gt;
<br />
&lt;div&gt;&lt;%- documentHTML %&gt;&lt;&#x2F;div&gt;
<br />
&lt;% if(publishAttributes.provider == &quot;github&quot;)
print(documentMarkdown); %&gt;
<br />
<br />
<a target="_blank" href="http://underscorejs.org/#template">More
info</a>

View File

@ -0,0 +1,10 @@
<p>Generates a table of content when a [TOC] marker is found.</p>
<div class="form-horizontal">
<div class="control-group">
<label class="control-label" for="input-toc-marker">Marker
RegExp</label>
<div class="controls">
<input type="text" id="input-toc-marker" class="span2">
</div>
</div>
</div>

36
js/main-min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -5,6 +5,8 @@ requirejs.config({
"jquery": "libs/jquery", "jquery": "libs/jquery",
"underscore": "libs/underscore", "underscore": "libs/underscore",
"jgrowl": "libs/jgrowl", "jgrowl": "libs/jgrowl",
"mousetrap": "libs/mousetrap",
"text": "libs/text",
"libs/MathJax": '../lib/MathJax/MathJax.js?config=TeX-AMS_HTML' "libs/MathJax": '../lib/MathJax/MathJax.js?config=TeX-AMS_HTML'
}, },
shim: { shim: {
@ -17,6 +19,9 @@ requirejs.config({
], ],
exports: 'jQuery.jGrowl' exports: 'jQuery.jGrowl'
}, },
'mousetrap': {
exports: 'Mousetrap'
},
'libs/jquery-ui': [ 'libs/jquery-ui': [
'jquery' 'jquery'
], ],
@ -65,7 +70,7 @@ require([
"core", "core",
"synchronizer", "synchronizer",
"publisher", "publisher",
"media-importer" "mediaImporter"
], function($, core) { ], function($, core) {
$(function() { $(function() {

View File

@ -2,7 +2,7 @@ define([
"jquery", "jquery",
"underscore", "underscore",
"core", "core",
"providers/gplus-provider" "providers/gplusProvider"
], function($, _, core) { ], function($, _, core) {
var mediaImporter = {}; var mediaImporter = {};

View File

@ -1,7 +1,7 @@
define([ define([
"underscore", "underscore",
"utils", "utils",
"helpers/google-helper" "helpers/googleHelper"
], function(_, utils, googleHelper) { ], function(_, utils, googleHelper) {
var PROVIDER_BLOGGER = "blogger"; var PROVIDER_BLOGGER = "blogger";

View File

@ -1,7 +1,7 @@
define([ define([
"jquery", "jquery",
"core", "core",
"async-runner" "asyncRunner"
], function($, core, asyncRunner) { ], function($, core, asyncRunner) {
var PROVIDER_DOWNLOAD = "download"; var PROVIDER_DOWNLOAD = "download";

View File

@ -1,9 +1,9 @@
define([ define([
"underscore", "underscore",
"utils", "utils",
"extension-manager", "extensionMgr",
"file-manager", "fileMgr",
"helpers/dropbox-helper" "helpers/dropboxHelper"
], function(_, utils, extensionMgr, fileMgr, dropboxHelper) { ], function(_, utils, extensionMgr, fileMgr, dropboxHelper) {
var PROVIDER_DROPBOX = "dropbox"; var PROVIDER_DROPBOX = "dropbox";

View File

@ -3,9 +3,9 @@ define([
"core", "core",
"utils", "utils",
"settings", "settings",
"extension-manager", "extensionMgr",
"file-manager", "fileMgr",
"helpers/google-helper" "helpers/googleHelper"
], function(_, core, utils, settings, extensionMgr, fileMgr, googleHelper) { ], function(_, core, utils, settings, extensionMgr, fileMgr, googleHelper) {
var PROVIDER_GDRIVE = "gdrive"; var PROVIDER_GDRIVE = "gdrive";

View File

@ -1,6 +1,6 @@
define([ define([
"utils", "utils",
"helpers/github-helper" "helpers/githubHelper"
], function(utils, githubHelper) { ], function(utils, githubHelper) {
var PROVIDER_GIST = "gist"; var PROVIDER_GIST = "gist";

View File

@ -1,7 +1,7 @@
define([ define([
"utils", "utils",
"settings", "settings",
"helpers/github-helper" "helpers/githubHelper"
], function(utils, settings, githubHelper) { ], function(utils, settings, githubHelper) {
var PROVIDER_GITHUB = "github"; var PROVIDER_GITHUB = "github";

View File

@ -2,8 +2,8 @@ define([
"underscore", "underscore",
"core", "core",
"utils", "utils",
"extension-manager", "extensionMgr",
"helpers/google-helper" "helpers/googleHelper"
], function(_, core, utils, extensionMgr, googleHelper) { ], function(_, core, utils, extensionMgr, googleHelper) {
var PROVIDER_GPLUS = "gplus"; var PROVIDER_GPLUS = "gplus";

View File

@ -1,6 +1,6 @@
define([ define([
"utils", "utils",
"helpers/ssh-helper" "helpers/sshHelper"
], function(utils, sshHelper) { ], function(utils, sshHelper) {
var PROVIDER_SSH = "ssh"; var PROVIDER_SSH = "ssh";

View File

@ -1,6 +1,6 @@
define([ define([
"utils", "utils",
"helpers/tumblr-helper" "helpers/tumblrHelper"
], function(utils, tumblrHelper) { ], function(utils, tumblrHelper) {
var PROVIDER_TUMBLR = "tumblr"; var PROVIDER_TUMBLR = "tumblr";

View File

@ -1,6 +1,6 @@
define([ define([
"utils", "utils",
"helpers/wordpress-helper" "helpers/wordpressHelper"
], function(utils, wordpressHelper) { ], function(utils, wordpressHelper) {
var PROVIDER_WORDPRESS = "wordpress"; var PROVIDER_WORDPRESS = "wordpress";

View File

@ -4,18 +4,18 @@ define([
"core", "core",
"utils", "utils",
"settings", "settings",
"extension-manager", "extensionMgr",
"file-system", "fileSystem",
"file-manager", "fileMgr",
"sharing", "sharing",
"providers/blogger-provider", "providers/bloggerProvider",
"providers/dropbox-provider", "providers/dropboxProvider",
"providers/gist-provider", "providers/gistProvider",
"providers/github-provider", "providers/githubProvider",
"providers/gdrive-provider", "providers/gdriveProvider",
"providers/ssh-provider", "providers/sshProvider",
"providers/tumblr-provider", "providers/tumblrProvider",
"providers/wordpress-provider" "providers/wordpressProvider"
], function($, _, core, utils, settings, extensionMgr, fileSystem, fileMgr, sharing) { ], function($, _, core, utils, settings, extensionMgr, fileSystem, fileMgr, sharing) {
var publisher = {}; var publisher = {};

View File

@ -3,11 +3,11 @@ define([
"underscore", "underscore",
"core", "core",
"utils", "utils",
"extension-manager", "extensionMgr",
"file-manager", "fileMgr",
"async-runner", "asyncRunner",
"providers/download-provider", "providers/downloadProvider",
"providers/gist-provider" "providers/gistProvider"
], function($, _, core, utils, extensionMgr, fileMgr, asyncRunner) { ], function($, _, core, utils, extensionMgr, fileMgr, asyncRunner) {
var sharing = {}; var sharing = {};
@ -20,30 +20,6 @@ define([
]; ];
}).compact().object().value(); }).compact().object().value();
// Used to populate the "Sharing" dropdown box
var lineTemplate = [
'<div class="input-prepend">',
' <a href="<%= link %>" class="add-on" title="Sharing location"><i class="icon-link"></i></a>',
' <input class="span2" type="text" value="<%= link %>" readonly />',
'</div>'
].join("");
sharing.refreshDocumentSharing = function(attributesList) {
var linkList = $("#link-container .link-list").empty();
$("#link-container .no-link").show();
_.each(attributesList, function(attributes) {
if(attributes.sharingLink) {
var lineElement = $(_.template(lineTemplate, {
link: attributes.sharingLink
}));
lineElement.click(function(event) {
event.stopPropagation();
});
linkList.append(lineElement);
$("#link-container .no-link").hide();
}
});
};
sharing.createLink = function(attributes, callback) { sharing.createLink = function(attributes, callback) {
var provider = providerMap[attributes.provider.providerId]; var provider = providerMap[attributes.provider.providerId];
// Don't create link if link already exists or provider is not // Don't create link if link already exists or provider is not

View File

@ -3,11 +3,11 @@ define([
"underscore", "underscore",
"core", "core",
"utils", "utils",
"extension-manager", "extensionMgr",
"file-system", "fileSystem",
"file-manager", "fileMgr",
"providers/dropbox-provider", "providers/dropboxProvider",
"providers/gdrive-provider" "providers/gdriveProvider"
], function($, _, core, utils, extensionMgr, fileSystem, fileMgr) { ], function($, _, core, utils, extensionMgr, fileSystem, fileMgr) {
var synchronizer = {}; var synchronizer = {};

View File

@ -46,7 +46,7 @@
<setting id="org.eclipse.wst.jsdt.core.formatter.indent_switchstatements_compare_to_cases" value="true"/> <setting id="org.eclipse.wst.jsdt.core.formatter.indent_switchstatements_compare_to_cases" value="true"/>
<setting id="org.eclipse.wst.jsdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call" value="16"/> <setting id="org.eclipse.wst.jsdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call" value="16"/>
<setting id="org.eclipse.wst.jsdt.core.formatter.align_type_members_on_columns" value="false"/> <setting id="org.eclipse.wst.jsdt.core.formatter.align_type_members_on_columns" value="false"/>
<setting id="org.eclipse.wst.jsdt.core.formatter.insert_space_before_opening_paren_in_catch" value="insert"/> <setting id="org.eclipse.wst.jsdt.core.formatter.insert_space_before_opening_paren_in_catch" value="do not insert"/>
<setting id="org.eclipse.wst.jsdt.core.formatter.insert_space_after_comma_in_type_arguments" value="insert"/> <setting id="org.eclipse.wst.jsdt.core.formatter.insert_space_after_comma_in_type_arguments" value="insert"/>
<setting id="org.eclipse.wst.jsdt.core.formatter.insert_space_before_opening_paren_in_annotation" value="do not insert"/> <setting id="org.eclipse.wst.jsdt.core.formatter.insert_space_before_opening_paren_in_annotation" value="do not insert"/>
<setting id="org.eclipse.wst.jsdt.core.formatter.comment.clear_blank_lines_in_block_comment" value="false"/> <setting id="org.eclipse.wst.jsdt.core.formatter.comment.clear_blank_lines_in_block_comment" value="false"/>