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

13
css/main-min.css vendored
View File

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

View File

@ -115,7 +115,7 @@
</ul>
</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-south preview-container hide"></div>
@ -671,124 +671,6 @@
<img src="img/stackedit-promo.png" />
</div>
<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 class="modal-footer">
<a href="#" class="btn btn-primary" data-dismiss="modal">Close</a>

View File

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

View File

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

View File

@ -3,13 +3,15 @@ define([
"underscore",
"utils",
"settings",
"extension-manager",
"extensionMgr",
"mousetrap",
"text!html/settingsTemplateTooltip.html",
"storage",
"config",
"libs/bootstrap",
"libs/layout",
"libs/Markdown.Editor"
], function($, _, utils, settings, extensionMgr) {
], function($, _, utils, settings, extensionMgr, mousetrap, settingsTemplateTooltipHTML) {
var core = {};
@ -216,7 +218,7 @@ define([
return;
}
var previewContainerElt = $(".preview-container");
// Store editor scrollTop on scroll event
editorElt.scroll(function() {
if(documentContent !== undefined) {
@ -236,8 +238,8 @@ define([
fileDesc.previewScrollTop = $(this).scrollTop();
}
});
// Create the converter and the editor
// Create the converter and the editor
var converter = new Markdown.Converter();
editor = new Markdown.Editor(converter);
// Custom insert link dialog
@ -363,7 +365,6 @@ define([
if(shownModalId != modalId) {
// Hack to avoid conflict with tabs, collapse, tooltips events
shownModalId = modalId;
Mousetrap.pause();
_.defer(function(elt) {
elt.find("input:enabled:visible:first").focus();
}, $(this));
@ -373,10 +374,7 @@ define([
var modalId = $(this).attr("id");
if(shownModalId == modalId && $(this).is(":hidden")) {
shownModalId = undefined;
Mousetrap.unpause();
_.defer(function() {
$("#wmd-input").focus();
});
$("#wmd-input").focus();
}
}).keyup(function(e) {
// 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
$(".action-insert-link").click(function(e) {
var value = utils.getInputTextValue($("#input-insert-link"), e);
@ -400,7 +403,7 @@ define([
core.insertLinkCallback = undefined;
}
});
// Hide events on "insert link" and "insert image" dialogs
$("#modal-insert-link, #modal-insert-image").on('hidden', function() {
if(core.insertLinkCallback !== undefined) {
@ -477,23 +480,7 @@ define([
container: '#modal-settings',
placement: 'right',
trigger: 'manual',
title: [
'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("")
title: settingsTemplateTooltipHTML
}).click(function(e) {
$(this).tooltip('show');
$(document).on("click.tooltip-template", function(e) {

View File

@ -3,24 +3,27 @@ define([
"underscore",
"utils",
"settings",
"extensions/button-sync",
"extensions/button-publish",
"extensions/button-share",
"extensions/button-stat",
"extensions/document-selector",
"extensions/document-title",
"extensions/manage-publication",
"extensions/manage-synchronization",
"extensions/working-indicator",
"text!html/settingsExtensionsAccordion.html",
"extensions/googleAnalytics",
"extensions/buttonSync",
"extensions/buttonPublish",
"extensions/buttonShare",
"extensions/buttonStat",
"extensions/dialogAbout",
"extensions/dialogManagePublication",
"extensions/dialogManageSynchronization",
"extensions/documentSelector",
"extensions/documentTitle",
"extensions/workingIndicator",
"extensions/notifications",
"extensions/markdown-extra",
"extensions/toc",
"extensions/math-jax",
"extensions/email-converter",
"extensions/scroll-link",
"extensions/mathJax",
"extensions/emailConverter",
"extensions/scrollLink",
"libs/bootstrap",
"libs/jquery.waitforimages"
], function($, _, utils, settings) {
], function($, _, utils, settings, settingsExtensionsAccordionHTML) {
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) {
$("#accordion-extensions").append($(_.template(accordionTmpl, {
$("#accordion-extensions").append($(_.template(settingsExtensionsAccordionHTML, {
extensionId: extension.extensionId,
extensionName: extension.extensionName,
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([
"jquery",
"underscore"
], function($, _) {
"underscore",
"text!html/buttonPublish.html",
], function($, _, buttonPublishHTML) {
var buttonPublish = {
extensionId: "buttonPublish",
@ -34,11 +35,7 @@ define([
};
buttonPublish.onCreateButton = function() {
button = $([
'<button class="btn" title="Publish this document">',
' <i class="icon-share"></i>',
'</button>'
].join("")).click(function() {
button = $(buttonPublishHTML).click(function() {
if(!$(this).hasClass("disabled")) {
publisher.publish();
}

View File

@ -1,7 +1,9 @@
define([
"jquery",
"underscore"
], function($, _) {
"underscore",
"text!html/buttonShare.html",
"text!html/buttonShareLocation.html",
], function($, _, buttonShareHTML, buttonShareLocationHTML) {
var buttonShare = {
extensionId: "buttonShare",
@ -11,33 +13,10 @@ define([
};
buttonShare.onCreateButton = function() {
return $([
'<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(""));
return $(buttonShareHTML);
};
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) {
if(fileDescParameter !== undefined && fileDescParameter !== fileDesc) {
return;
@ -49,7 +28,7 @@ define([
var attributesList = _.values(fileDesc.publishLocations);
_.each(attributesList, function(attributes) {
if(attributes.sharingLink) {
var lineElement = $(_.template(lineTemplate, {
var lineElement = $(_.template(buttonShareLocationHTML, {
link: attributes.sharingLink
}));
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([
"jquery",
"underscore"
], function($, _) {
"underscore",
"text!html/buttonSync.html",
], function($, _, buttonSyncHTML) {
var buttonSync = {
extensionId: "buttonSync",
@ -32,11 +33,7 @@ define([
};
buttonSync.onCreateButton = function() {
button = $([
'<button class="btn" title="Synchronize all documents">',
' <i class="icon-refresh"></i>',
'</button>'
].join("")).click(function() {
button = $(buttonSyncHTML).click(function() {
if(!$(this).hasClass("disabled")) {
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([
"jquery",
"underscore"
], function($, _) {
"underscore",
"text!html/dialogManagePublicationLocation.html",
], function($, _, dialogManagePublicationLocationHTML) {
var managePublication = {
extensionId: "managePublication",
extensionName: "Manage publication",
var dialogManagePublication = {
extensionId: "dialogManagePublication",
extensionName: 'Dialog "Manage publication"',
settingsBloc: '<p>Populates the "Manage publication" dialog box.</p>'
};
var fileMgr = undefined;
managePublication.onFileMgrCreated = function(fileMgrParameter) {
dialogManagePublication.onFileMgrCreated = function(fileMgrParameter) {
fileMgr = fileMgrParameter;
};
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 refreshDialog = function(fileDescParameter) {
if(fileDescParameter !== undefined && fileDescParameter !== fileDesc) {
@ -44,7 +37,7 @@ define([
formattedAttributes.password = "********";
}
var publishDesc = JSON.stringify(formattedAttributes).replace(/{|}|"/g, "").replace(/,/g, ", ");
var lineElement = $(_.template(lineTemplate, {
var lineElement = $(_.template(dialogManagePublicationLocationHTML, {
provider: publishAttributes.provider,
publishDesc: publishDesc
}));
@ -55,14 +48,14 @@ define([
});
};
managePublication.onFileSelected = function(fileDescParameter) {
dialogManagePublication.onFileSelected = function(fileDescParameter) {
fileDesc = fileDescParameter;
refreshDialog(fileDescParameter);
};
managePublication.onNewPublishSuccess = refreshDialog;
managePublication.onPublishRemoved = refreshDialog;
dialogManagePublication.onNewPublishSuccess = refreshDialog;
dialogManagePublication.onPublishRemoved = refreshDialog;
return managePublication;
return dialogManagePublication;
});

View File

@ -1,28 +1,21 @@
define([
"jquery",
"underscore"
], function($, _) {
"underscore",
"text!html/dialogManageSynchronizationLocation.html",
], function($, _, dialogManageSynchronizationLocationHTML) {
var manageSynchronization = {
extensionId: "manageSynchronization",
extensionName: "Manage synchronization",
var dialogManageSynchronization = {
extensionId: "dialogManageSynchronization",
extensionName: 'Dialog "Manage synchronization"',
settingsBloc: '<p>Populates the "Manage synchronization" dialog box.</p>'
};
var fileMgr = undefined;
manageSynchronization.onFileMgrCreated = function(fileMgrParameter) {
dialogManageSynchronization.onFileMgrCreated = function(fileMgrParameter) {
fileMgr = fileMgrParameter;
};
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 refreshDialog = function(fileDescParameter) {
if(fileDescParameter !== undefined && fileDescParameter !== fileDesc) {
@ -40,7 +33,7 @@ define([
}
_.each(syncAttributesList, function(syncAttributes) {
var syncDesc = syncAttributes.id || syncAttributes.path;
var lineElement = $(_.template(lineTemplate, {
var lineElement = $(_.template(dialogManageSynchronizationLocationHTML, {
provider: syncAttributes.provider,
syncDesc: syncDesc
}));
@ -51,15 +44,15 @@ define([
});
};
manageSynchronization.onFileSelected = function(fileDescParameter) {
dialogManageSynchronization.onFileSelected = function(fileDescParameter) {
fileDesc = fileDescParameter;
refreshDialog(fileDescParameter);
};
manageSynchronization.onSyncExportSuccess = refreshDialog;
manageSynchronization.onSyncRemoved = refreshDialog;
dialogManageSynchronization.onSyncExportSuccess = refreshDialog;
dialogManageSynchronization.onSyncRemoved = refreshDialog;
manageSynchronization.onReady = function() {
dialogManageSynchronization.onReady = function() {
// Handle enter key in the sync manual inputs
$(".sync-manual").each(function() {
var elt = $(this);
@ -72,6 +65,6 @@ define([
});
};
return manageSynchronization;
return dialogManageSynchronization;
});

View File

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

View File

@ -5,7 +5,7 @@ define([
var documentTitle = {
extensionId: "documentTitle",
extensionName: "Document title",
extensionName: "Document Title",
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([
"utils",
"libs/Markdown.Extra"
], function(utils) {
"text!html/markdownExtraSettingsBloc.html",
"libs/Markdown.Extra",
], function(utils, markdownExtraSettingsBlocHTML) {
var markdownExtra = {
extensionId: "markdownExtra",
@ -10,17 +11,7 @@ define([
defaultConfig: {
prettify: true
},
settingsBloc: [
'<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("")
settingsBloc: markdownExtraSettingsBlocHTML
};
markdownExtra.onLoadSettings = function() {

View File

@ -2,8 +2,9 @@ define([
"jquery",
"underscore",
"utils",
"jgrowl"
], function($, _, utils, jGrowl) {
"jgrowl",
"text!html/notificationsSettingsBloc.html",
], function($, _, utils, jGrowl, notificationsSettingsBlocHTML) {
var notifications = {
extensionId: "notifications",
@ -11,18 +12,7 @@ define([
defaultConfig: {
timeout: 8000
},
settingsBloc: [
'<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("")
settingsBloc: notificationsSettingsBlocHTML
};
notifications.onLoadSettings = function() {

View File

@ -1,21 +1,16 @@
define([
"jquery",
"underscore",
"text!html/scrollLinkSettingsBloc.html",
"libs/css_browser_selector",
"libs/jquery.mousewheel"
], function($, _) {
], function($, _, scrollLinkSettingsBlocHTML) {
var scrollLink = {
extensionId: "scrollLink",
extensionName: "Scroll Link",
optional: true,
settingsBloc: [
'<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("")
settingsBloc: scrollLinkSettingsBlocHTML
};
var mdSectionList = [];

View File

@ -1,8 +1,9 @@
define([
"jquery",
"underscore",
"utils"
], function($, _, utils) {
"utils",
"text!html/tocSettingsBloc.html",
], function($, _, utils, tocSettingsBlocHTML) {
var toc = {
extensionId: "toc",
@ -11,17 +12,7 @@ define([
defaultConfig: {
marker: "\\[(TOC|toc)\\]"
},
settingsBloc: [
'<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("")
settingsBloc: tocSettingsBlocHTML
};
toc.onLoadSettings = function() {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -2,8 +2,8 @@ define([
"jquery",
"core",
"utils",
"extension-manager",
"async-runner"
"extensionMgr",
"asyncRunner"
], function($, core, utils, extensionMgr, asyncRunner) {
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",
"underscore": "libs/underscore",
"jgrowl": "libs/jgrowl",
"mousetrap": "libs/mousetrap",
"text": "libs/text",
"libs/MathJax": '../lib/MathJax/MathJax.js?config=TeX-AMS_HTML'
},
shim: {
@ -17,6 +19,9 @@ requirejs.config({
],
exports: 'jQuery.jGrowl'
},
'mousetrap': {
exports: 'Mousetrap'
},
'libs/jquery-ui': [
'jquery'
],
@ -65,7 +70,7 @@ require([
"core",
"synchronizer",
"publisher",
"media-importer"
"mediaImporter"
], function($, core) {
$(function() {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -3,11 +3,11 @@ define([
"underscore",
"core",
"utils",
"extension-manager",
"file-manager",
"async-runner",
"providers/download-provider",
"providers/gist-provider"
"extensionMgr",
"fileMgr",
"asyncRunner",
"providers/downloadProvider",
"providers/gistProvider"
], function($, _, core, utils, extensionMgr, fileMgr, asyncRunner) {
var sharing = {};
@ -20,30 +20,6 @@ define([
];
}).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) {
var provider = providerMap[attributes.provider.providerId];
// Don't create link if link already exists or provider is not

View File

@ -3,11 +3,11 @@ define([
"underscore",
"core",
"utils",
"extension-manager",
"file-system",
"file-manager",
"providers/dropbox-provider",
"providers/gdrive-provider"
"extensionMgr",
"fileSystem",
"fileMgr",
"providers/dropboxProvider",
"providers/gdriveProvider"
], function($, _, core, utils, extensionMgr, fileSystem, fileMgr) {
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.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.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_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"/>