summaryrefslogtreecommitdiff
path: root/public
diff options
context:
space:
mode:
Diffstat (limited to 'public')
-rw-r--r--public/js/common.js38
-rw-r--r--public/js/config.js.example17
-rw-r--r--public/js/cover.js33
-rw-r--r--public/js/extra.js182
-rw-r--r--public/js/history.js28
-rw-r--r--public/js/index.js115
-rw-r--r--public/js/locale.js4
-rw-r--r--public/js/pretty.js23
-rw-r--r--public/js/public.js27
-rw-r--r--public/js/render.js7
-rw-r--r--public/js/slide.js42
-rw-r--r--public/js/syncscroll.js40
-rw-r--r--public/vendor/codemirror-spell-checker/spell-checker.min.js2
-rw-r--r--public/views/foot.ejs69
-rw-r--r--public/views/head.ejs9
-rw-r--r--public/views/includes/header.ejs3
-rw-r--r--public/views/includes/scripts.ejs3
-rw-r--r--public/views/index.ejs20
-rw-r--r--public/views/pretty.ejs54
-rw-r--r--public/views/slide.ejs44
20 files changed, 467 insertions, 293 deletions
diff --git a/public/js/common.js b/public/js/common.js
index 047df8af..19455f3d 100644
--- a/public/js/common.js
+++ b/public/js/common.js
@@ -1,3 +1,11 @@
+var config = require('./config');
+var domain = config.domain; // domain name
+var urlpath = config.urlpath; // sub url path, like: www.example.com/<urlpath>
+var debug = config.debug;
+var GOOGLE_API_KEY = config.GOOGLE_API_KEY;
+var GOOGLE_CLIENT_ID = config.GOOGLE_CLIENT_ID;
+var DROPBOX_APP_KEY = config.DROPBOX_APP_KEY;
+
//common
var port = window.location.port;
var serverurl = window.location.protocol + '//' + (domain ? domain : window.location.hostname) + (port ? ':' + port : '') + (urlpath ? '/' + urlpath : '');
@@ -82,4 +90,32 @@ function checkIfAuth(yesCallback, noCallback) {
} else {
noCallback();
}
-} \ No newline at end of file
+}
+
+module.exports = {
+ domain: domain,
+ urlpath: urlpath,
+ debug: debug,
+ GOOGLE_API_KEY: GOOGLE_API_KEY,
+ GOOGLE_CLIENT_ID: GOOGLE_CLIENT_ID,
+ DROPBOX_APP_KEY: DROPBOX_APP_KEY,
+ port: port,
+ serverurl: serverurl,
+ noteid: noteid,
+ noteurl: noteurl,
+ version: version,
+ checkAuth: checkAuth,
+ profile: profile,
+ lastLoginState: lastLoginState,
+ lastUserId: lastUserId,
+ loginStateChangeEvent: loginStateChangeEvent,
+
+ /* export functions */
+ resetCheckAuth: resetCheckAuth,
+ setLoginState: setLoginState,
+ checkLoginStateChanged: checkLoginStateChanged,
+ getLoginState: getLoginState,
+ getUserId: getUserId,
+ clearLoginState: clearLoginState,
+ checkIfAuth: checkIfAuth
+};
diff --git a/public/js/config.js.example b/public/js/config.js.example
index 197d18f2..c5de388f 100644
--- a/public/js/config.js.example
+++ b/public/js/config.js.example
@@ -1,10 +1,11 @@
-//config
-var domain = ''; // domain name
-var urlpath = ''; // sub url path, like: www.example.com/<urlpath>
-//settings
-var debug = false;
+module.exports = {
+ domain: '', // domain name
+ urlpath: '', // sub url path, like: www.example.com/<urlpath>
-var GOOGLE_API_KEY = '';
-var GOOGLE_CLIENT_ID = '';
+ // settings
+ debug: false,
-var DROPBOX_APP_KEY = ''; \ No newline at end of file
+ GOOGLE_API_KEY: '',
+ GOOGLE_CLIENT_ID: '',
+ DROPBOX_APP_KEY: ''
+};
diff --git a/public/js/cover.js b/public/js/cover.js
index 3f9d787e..30a8e5c8 100644
--- a/public/js/cover.js
+++ b/public/js/cover.js
@@ -1,3 +1,26 @@
+var common = require('./common');
+var checkIfAuth = common.checkIfAuth;
+var urlpath = common.urlpath;
+var serverurl = common.serverurl;
+var resetCheckAuth = common.resetCheckAuth;
+var getLoginState = common.getLoginState;
+var clearLoginState = common.clearLoginState;
+
+var historyModule = require('./history');
+var parseStorageToHistory = historyModule.parseStorageToHistory;
+var parseHistory = historyModule.parseHistory;
+var getStorageHistory = historyModule.getStorageHistory;
+var getHistory = historyModule.getHistory;
+var saveHistory = historyModule.saveHistory;
+var removeHistory = historyModule.removeHistory;
+var postHistoryToServer = historyModule.postHistoryToServer;
+var deleteServerHistory = historyModule.deleteServerHistory;
+var parseServerToHistory = historyModule.parseServerToHistory;
+var saveStorageHistoryToServer = historyModule.saveStorageHistoryToServer;
+
+var saveAs = require('file-saver').saveAs;
+var List = require('list.js');
+
var options = {
valueNames: ['id', 'text', 'timestamp', 'fromNow', 'time', 'tags', 'pinned'],
item: '<li class="col-xs-12 col-sm-6 col-md-6 col-lg-4">\
@@ -199,7 +222,7 @@ function historyPinClick(e) {
$this.addClass('active');
else
$this.removeClass('active');
- }
+ }
});
}, function () {
getHistory(function (notehistory) {
@@ -317,7 +340,7 @@ $(".ui-clear-history").click(function () {
});
$(".ui-refresh-history").click(function () {
- var lastTags = $(".ui-use-tags").select2('val');
+ var lastTags = $(".ui-use-tags").select2('val');
$(".ui-use-tags").select2('val', '');
historyList.filter();
var lastKeyword = $('.search').val();
@@ -325,10 +348,10 @@ $(".ui-refresh-history").click(function () {
historyList.search();
$('#history-list').slideUp('fast');
$('.pagination').slideUp('fast');
-
+
resetCheckAuth();
historyList.clear();
- parseHistory(historyList, function (list, notehistory) {
+ parseHistory(historyList, function (list, notehistory) {
parseHistoryCallback(list, notehistory);
$(".ui-use-tags").select2('val', lastTags);
$(".ui-use-tags").trigger('change');
@@ -392,4 +415,4 @@ $(".ui-use-tags").on('change', function () {
$('.search').keyup(function () {
checkHistoryList();
-}); \ No newline at end of file
+});
diff --git a/public/js/extra.js b/public/js/extra.js
index 4a6c4a67..24d53fe7 100644
--- a/public/js/extra.js
+++ b/public/js/extra.js
@@ -1,3 +1,9 @@
+var hljs = require('highlight.js');
+var PDFObject = require('pdfobject');
+var S = require('string');
+var saveAs = require('file-saver').saveAs;
+require('../vendor/md-toc');
+
//auto update last change
var createtime = null;
var lastchangetime = null;
@@ -242,7 +248,7 @@ function finishView(view) {
});
//emojify
try {
- emojify.run(view[0]);
+ emojify.run(view[0]);
} catch (err) {
console.warn(err);
}
@@ -257,77 +263,79 @@ function finishView(view) {
MathJax.Hub.Queue(viewAjaxCallback);
}
} catch (err) {}
- //sequence diagram
- var sequences = view.find(".sequence-diagram.raw").removeClass("raw");
- sequences.each(function (key, value) {
- try {
- var $value = $(value);
- var $ele = $(value).parent().parent();
-
- var sequence = $value;
- sequence.sequenceDiagram({
- theme: 'simple'
- });
-
- $ele.addClass('sequence-diagram');
- $value.children().unwrap().unwrap();
- var svg = $ele.find('> svg');
- svg[0].setAttribute('viewBox', '0 0 ' + svg.attr('width') + ' ' + svg.attr('height'));
- svg[0].setAttribute('preserveAspectRatio', 'xMidYMid meet');
- } catch (err) {
- console.warn(err);
- }
- });
- //flowchart
- var flow = view.find(".flow-chart.raw").removeClass("raw");
- flow.each(function (key, value) {
- try {
- var $value = $(value);
- var $ele = $(value).parent().parent();
-
- var chart = flowchart.parse($value.text());
- $value.html('');
- chart.drawSVG(value, {
- 'line-width': 2,
- 'fill': 'none',
- 'font-size': '16px',
- 'font-family': "'Andale Mono', monospace"
- });
-
- $ele.addClass('flow-chart');
- $value.children().unwrap().unwrap();
- } catch (err) {
- console.warn(err);
- }
- });
+ //sequence diagram
+ var sequences = view.find(".sequence-diagram.raw").removeClass("raw");
+ sequences.each(function (key, value) {
+ try {
+ var $value = $(value);
+ var $ele = $(value).parent().parent();
+
+ var sequence = $value;
+ sequence.sequenceDiagram({
+ theme: 'simple'
+ });
+
+ $ele.addClass('sequence-diagram');
+ $value.children().unwrap().unwrap();
+ var svg = $ele.find('> svg');
+ svg[0].setAttribute('viewBox', '0 0 ' + svg.attr('width') + ' ' + svg.attr('height'));
+ svg[0].setAttribute('preserveAspectRatio', 'xMidYMid meet');
+ } catch (err) {
+ console.warn(err);
+ }
+ });
+ //flowchart
+ var flow = view.find(".flow-chart.raw").removeClass("raw");
+ flow.each(function (key, value) {
+ try {
+ var $value = $(value);
+ var $ele = $(value).parent().parent();
+
+ var chart = flowchart.parse($value.text());
+ $value.html('');
+ chart.drawSVG(value, {
+ 'line-width': 2,
+ 'fill': 'none',
+ 'font-size': '16px',
+ 'font-family': "'Andale Mono', monospace"
+ });
+
+ $ele.addClass('flow-chart');
+ $value.children().unwrap().unwrap();
+ } catch (err) {
+ console.warn(err);
+ }
+ });
//graphviz
+ var Viz = require("viz.js");
var graphvizs = view.find(".graphviz.raw").removeClass("raw");
graphvizs.each(function (key, value) {
try {
var $value = $(value);
var $ele = $(value).parent().parent();
-
+
var graphviz = Viz($value.text());
$value.html(graphviz);
-
+
$ele.addClass('graphviz');
$value.children().unwrap().unwrap();
} catch (err) {
console.warn(err);
}
});
+
//mermaid
var mermaids = view.find(".mermaid.raw").removeClass("raw");
mermaids.each(function (key, value) {
try {
var $value = $(value);
var $ele = $(value).parent().parent();
-
+
var mermaidError = null;
mermaid.parseError = function (err, hash) {
mermaidError = err;
};
-
+
if (mermaidAPI.parse($value.text())) {
$ele.addClass('mermaid');
$ele.html($value.text());
@@ -427,14 +435,14 @@ function finishView(view) {
});
//pdf
view.find(".pdf.raw").removeClass("raw")
- .each(function (key, value) {
- var url = $(value).attr('data-pdfurl');
- var inner = $('<div></div>');
- $(this).append(inner);
- PDFObject.embed(url, inner, {
- height: '400px'
+ .each(function (key, value) {
+ var url = $(value).attr('data-pdfurl');
+ var inner = $('<div></div>');
+ $(this).append(inner);
+ PDFObject.embed(url, inner, {
+ height: '400px'
+ });
});
- });
//syntax highlighting
view.find("pre.raw").removeClass("raw")
.each(function (key, value) {
@@ -483,6 +491,7 @@ function postProcess(code) {
}
return result;
}
+window.postProcess = postProcess;
function generateCleanHTML(view) {
var src = view.clone();
@@ -534,6 +543,8 @@ function exportToRawHTML(view) {
saveAs(blob, filename);
}
+var common = require('./common.js');
+var serverurl = common.serverurl;
//extract markdown body to html and compile to template
function exportToHTML(view) {
var title = renderTitle(ui.area.markdown);
@@ -829,7 +840,10 @@ emojify.setConfig({
ignore_emoticons: true
});
-var md = window.markdownit('default', {
+var markdownit = require('markdown-it');
+var markdownitContainer = require('markdown-it-container');
+
+var md = markdownit('default', {
html: true,
breaks: true,
langPrefix: "",
@@ -837,25 +851,28 @@ var md = window.markdownit('default', {
typographer: true,
highlight: highlightRender
});
-md.use(window.markdownitAbbr);
-md.use(window.markdownitFootnote);
-md.use(window.markdownitDeflist);
-md.use(window.markdownitMark);
-md.use(window.markdownitIns);
-md.use(window.markdownitSub);
-md.use(window.markdownitSup);
-md.use(window.markdownitMathjax);
-md.use(window.markdownitImsize);
+window.md = md;
+
+md.use(require('markdown-it-abbr'));
+md.use(require('markdown-it-footnote'));
+md.use(require('markdown-it-deflist'));
+md.use(require('markdown-it-mark'));
+md.use(require('markdown-it-ins'));
+md.use(require('markdown-it-sub'));
+md.use(require('markdown-it-sup'));
+md.use(require('../vendor/markdown-it-mathjax'));
+md.use(require('markdown-it-imsize'));
+
function renderContainer(tokens, idx, options, env, self) {
tokens[idx].attrJoin('role', 'alert');
tokens[idx].attrJoin('class', 'alert');
tokens[idx].attrJoin('class', 'alert-' + tokens[idx].info.trim());
return self.renderToken.apply(self, arguments);
}
-md.use(window.markdownitContainer, 'success', { render: renderContainer });
-md.use(window.markdownitContainer, 'info', { render: renderContainer });
-md.use(window.markdownitContainer, 'warning', { render: renderContainer });
-md.use(window.markdownitContainer, 'danger', { render: renderContainer });
+md.use(markdownitContainer, 'success', { render: renderContainer });
+md.use(markdownitContainer, 'info', { render: renderContainer });
+md.use(markdownitContainer, 'warning', { render: renderContainer });
+md.use(markdownitContainer, 'danger', { render: renderContainer });
md.renderer.rules.image = function (tokens, idx, options, env, self) {
tokens[idx].attrJoin('class', 'raw');
@@ -900,6 +917,9 @@ md.renderer.rules.fence = function (tokens, idx, options, env, self) {
+ '</code></pre>\n';
};
+/* Defined regex markdown it plugins */
+require('script!../vendor/markdown-it-regexp');
+
//youtube
var youtubePlugin = new Plugin(
// regexp to match
@@ -1046,4 +1066,26 @@ md.use(gistPlugin);
md.use(tocPlugin);
md.use(slidesharePlugin);
md.use(speakerdeckPlugin);
-md.use(pdfPlugin); \ No newline at end of file
+md.use(pdfPlugin);
+
+module.exports = {
+ md: md,
+ createtime: createtime,
+ lastchangetime: lastchangetime,
+ updateLastChange: updateLastChange,
+ lastchangeui: lastchangeui,
+ lastchangeuser: lastchangeuser,
+ postProcess: postProcess,
+ finishView: finishView,
+ autoLinkify: autoLinkify,
+ deduplicatedHeaderId: deduplicatedHeaderId,
+ renderTOC: renderTOC,
+ renderTitle: renderTitle,
+ renderFilename: renderFilename,
+ generateToc: generateToc,
+ smoothHashScroll: smoothHashScroll,
+ scrollToHash: scrollToHash,
+ owner: owner,
+ updateLastChangeUser: updateLastChangeUser,
+ updateOwner: updateOwner
+};
diff --git a/public/js/history.js b/public/js/history.js
index 324a9da2..d5082dd9 100644
--- a/public/js/history.js
+++ b/public/js/history.js
@@ -1,3 +1,15 @@
+var store = require('store');
+
+var common = require('./common');
+var checkIfAuth = common.checkIfAuth;
+var urlpath = common.urlpath;
+var serverurl = common.serverurl;
+var getLoginState = common.getLoginState;
+
+var extra = require('./extra');
+var renderFilename = extra.renderFilename;
+var md = extra.md;
+
var migrateHistoryFromTempCallback = null;
migrateHistoryFromTemp();
@@ -392,4 +404,18 @@ function deleteServerHistory(noteId, callback) {
console.error(xhr.responseText);
return callback(error, null);
});
-} \ No newline at end of file
+}
+
+module.exports = {
+ writeHistory: writeHistory,
+ parseHistory: parseHistory,
+ getStorageHistory: getStorageHistory,
+ getHistory: getHistory,
+ saveHistory: saveHistory,
+ removeHistory: removeHistory,
+ parseStorageToHistory: parseStorageToHistory,
+ postHistoryToServer: postHistoryToServer,
+ deleteServerHistory: deleteServerHistory,
+ parseServerToHistory: parseServerToHistory,
+ saveStorageHistoryToServer: saveStorageHistoryToServer
+}
diff --git a/public/js/index.js b/public/js/index.js
index 06be2f77..20a76ff1 100644
--- a/public/js/index.js
+++ b/public/js/index.js
@@ -1,3 +1,68 @@
+/* jquery and jquery plugins */
+require('../vendor/showup/showup');
+
+require('prismjs/themes/prism.css');
+require('highlight.js/styles/github-gist.css');
+
+require('prismjs');
+require('prismjs/components/prism-wiki');
+var toMarkdown = require('to-markdown');
+
+var saveAs = require('file-saver').saveAs;
+require('js-url');
+require('randomcolor');
+
+var _ = require("lodash");
+
+var List = require('list.js');
+
+var common = require('./common.js');
+var urlpath = common.urlpath;
+var noteid = common.noteid;
+var debug = common.debug;
+var version = common.version;
+var serverurl = common.serverurl;
+var GOOGLE_API_KEY = common.GOOGLE_API_KEY;
+var GOOGLE_CLIENT_ID = common.GOOGLE_CLIENT_ID;
+var DROPBOX_APP_KEY = common.DROPBOX_APP_KEY;
+var noteurl = common.noteurl;
+
+var checkLoginStateChanged = common.checkLoginStateChanged;
+
+var syncScroll = require('./syncscroll');
+var setupSyncAreas = syncScroll.setupSyncAreas;
+var clearMap = syncScroll.clearMap;
+var syncScrollToEdit = syncScroll.syncScrollToEdit;
+var syncScrollToView = syncScroll.syncScrollToView;
+
+require('./pretty');
+var extra = require('./extra');
+var md = extra.md;
+var createtime = extra.createtime;
+var updateLastChange = extra.updateLastChange;
+var postProcess = extra.postProcess;
+var finishView = extra.finishView;
+var lastchangetime = extra.lastchangetime;
+var autoLinkify = extra.autoLinkify;
+var generateToc = extra.generateToc;
+var smoothHashScroll = extra.smoothHashScroll;
+var lastchangeuser = extra.lastchangeuser;
+var deduplicatedHeaderId = extra.deduplicatedHeaderId;
+var renderTOC = extra.renderTOC;
+var renderTitle = extra.renderTitle;
+var renderFilename = extra.renderFilename;
+var scrollToHash = extra.scrollToHash;
+var owner = extra.owner;
+var updateLastChangeUser = extra.updateLastChangeUser;
+var updateOwner = extra.updateOwner;
+
+var historyModule = require('./history');
+var writeHistory = historyModule.writeHistory;
+var deleteServerHistory = historyModule.deleteServerHistory;
+
+var renderer = require('./render');
+var preventXSS = renderer.preventXSS;
+
var defaultTextHeight = 20;
var viewportMargin = 20;
var mac = CodeMirror.keyMap["default"] == CodeMirror.keyMap.macDefault;
@@ -127,7 +192,7 @@ function wrapTextWith(cm, symbol) {
};
var postText = cm.getRange(postEndPos, from);
var postIndex = wrapSymbols.indexOf(postText);
- // check if surround symbol are list in array and matched
+ // check if surround symbol are list in array and matched
if (preIndex > -1 && postIndex > -1 && preIndex === postIndex) {
cm.replaceRange("", to, preEndPos, '+delete');
cm.replaceRange("", postEndPos, from, '+delete');
@@ -279,7 +344,7 @@ var supportExtraTags = [
}
}
];
-var modeType = {
+window.modeType = {
edit: {
name: "edit"
},
@@ -310,18 +375,18 @@ var statusType = {
var defaultMode = modeType.view;
//global vars
-var loaded = false;
-var needRefresh = false;
-var isDirty = false;
-var editShown = false;
-var visibleXS = false;
-var visibleSM = false;
-var visibleMD = false;
-var visibleLG = false;
-var isTouchDevice = 'ontouchstart' in document.documentElement;
-var currentMode = defaultMode;
-var currentStatus = statusType.offline;
-var lastInfo = {
+window.loaded = false;
+window.needRefresh = false;
+window.isDirty = false;
+window.editShown = false;
+window.visibleXS = false;
+window.visibleSM = false;
+window.visibleMD = false;
+window.visibleLG = false;
+window.isTouchDevice = 'ontouchstart' in document.documentElement;
+window.currentMode = defaultMode;
+window.currentStatus = statusType.offline;
+window.lastInfo = {
needRestore: false,
cursor: null,
scroll: null,
@@ -343,9 +408,9 @@ var lastInfo = {
},
history: null
};
-var personalInfo = {};
-var onlineUsers = [];
-var fileTypes = {
+window.personalInfo = {};
+window.onlineUsers = [];
+window.fileTypes = {
"pl": "perl",
"cgi": "perl",
"js": "javascript",
@@ -359,7 +424,7 @@ var fileTypes = {
//editor settings
var textit = document.getElementById("textit");
if (!textit) throw new Error("There was no textit area!");
-var editor = CodeMirror.fromTextArea(textit, {
+window.editor = CodeMirror.fromTextArea(textit, {
mode: defaultEditorMode,
backdrop: defaultEditorMode,
keyMap: "sublime",
@@ -1047,7 +1112,7 @@ function checkEditorStyle() {
},
stop: function (e) {
lastEditorWidth = ui.area.edit.width();
- // workaround that scroll event bindings
+ // workaround that scroll event bindings
preventSyncScrollToView = 2;
preventSyncScrollToEdit = true;
editor.setOption('viewportMargin', viewportMargin);
@@ -1281,12 +1346,12 @@ function changeMode(type) {
preventSyncScrollToView = 2;
syncScrollToEdit(null, true);
}
-
+
if (lastMode == modeType.edit && currentMode == modeType.both) {
preventSyncScrollToEdit = 2;
syncScrollToView(null, true);
}
-
+
if (lastMode == modeType.both && currentMode != modeType.both) {
preventSyncScrollToView = false;
preventSyncScrollToEdit = false;
@@ -1389,6 +1454,7 @@ function onGoogleAPILoaded() {
.prop('defer', true)
.appendTo('body');
}
+window.onGoogleAPILoaded = onGoogleAPILoaded;
//button actions
//share
@@ -1687,7 +1753,7 @@ function parseRevisions(_revisions) {
}
}
function selectRevision(time) {
- if (time == revisionTime) return;
+ if (time == revisionTime) return;
$.get(noteurl + '/revision/' + time)
.done(function(data) {
revision = data;
@@ -2188,8 +2254,11 @@ function havePermission() {
}
return bool;
}
+// global module workaround
+window.havePermission = havePermission;
//socket.io actions
+var io = require("socket.io-client");
var socket = io.connect({
path: urlpath ? '/' + urlpath + '/socket.io/' : '',
timeout: 5000 //5 secs to timeout
@@ -2198,7 +2267,7 @@ var socket = io.connect({
var on = socket.on;
socket.on = function () {
if (!checkLoginStateChanged() && !needRefresh)
- on.apply(socket, arguments);
+ return on.apply(socket, arguments);
};
var emit = socket.emit;
socket.emit = function () {
diff --git a/public/js/locale.js b/public/js/locale.js
index 6fe7fdb6..484ce22f 100644
--- a/public/js/locale.js
+++ b/public/js/locale.js
@@ -1,3 +1,5 @@
+require('./cover');
+
var lang = "en";
var userLang = navigator.language || navigator.userLanguage;
var userLangCode = userLang.split('-')[0];
@@ -21,4 +23,4 @@ locale.change(function() {
expires: 365
});
window.location.reload();
-}); \ No newline at end of file
+});
diff --git a/public/js/pretty.js b/public/js/pretty.js
index 0ca7ee18..6b551c17 100644
--- a/public/js/pretty.js
+++ b/public/js/pretty.js
@@ -1,3 +1,16 @@
+var extra = require('./extra');
+var md = extra.md;
+var finishView = extra.finishView;
+var autoLinkify = extra.autoLinkify;
+var deduplicatedHeaderId = extra.deduplicatedHeaderId;
+var renderTOC = extra.renderTOC;
+var generateToc = extra.generateToc;
+var smoothHashScroll = extra.smoothHashScroll;
+var postProcess = extra.postProcess;
+var lastchangeui = extra.lastchangeui;
+var updateLastChange = extra.updateLastChange;
+var preventXSS = require('./render').preventXSS;
+
var markdown = $(".markdown-body");
var text = $('<textarea/>').html(markdown.html()).text();
var lastMeta = md.meta;
@@ -109,4 +122,12 @@ function scrollToBottom() {
$('body, html').stop(true, true).animate({
scrollTop: $(document.body)[0].scrollHeight
}, 100, "linear");
-} \ No newline at end of file
+}
+
+window.scrollToTop = scrollToTop;
+window.scrollToBottom = scrollToBottom;
+
+module.exports = {
+ scrollToBottom: scrollToBottom,
+ scrollToTop: scrollToTop
+}
diff --git a/public/js/public.js b/public/js/public.js
new file mode 100644
index 00000000..ac951804
--- /dev/null
+++ b/public/js/public.js
@@ -0,0 +1,27 @@
+/* jquery and jquery plugins */
+require('../vendor/showup/showup');
+
+require('prismjs/themes/prism.css');
+require('highlight.js/styles/github-gist.css');
+
+/* other vendors plugin */
+require('gist-embed');
+require('string');
+require('highlight.js');
+require('prismjs');
+require('prismjs/components/prism-wiki');
+require('to-markdown');
+
+require('file-saver');
+require('store');
+require('js-url');
+require('visibilityjs');
+require('list.js');
+require('../vendor/md-toc');
+require('randomcolor');
+
+require('./syncscroll');
+require('./extra');
+require('./history');
+require('./pretty');
+require('./render');
diff --git a/public/js/render.js b/public/js/render.js
index 6f1a1c19..77778795 100644
--- a/public/js/render.js
+++ b/public/js/render.js
@@ -50,4 +50,9 @@ var filterXSSOptions = {
function preventXSS(html) {
return filterXSS(html, filterXSSOptions);
-} \ No newline at end of file
+}
+window.preventXSS = preventXSS;
+
+module.exports = {
+ preventXSS: preventXSS
+}
diff --git a/public/js/slide.js b/public/js/slide.js
index 5b0f9bd0..257c60bb 100644
--- a/public/js/slide.js
+++ b/public/js/slide.js
@@ -1,3 +1,45 @@
+require('prismjs/themes/prism.css');
+
+/* other vendors plugin */
+var S = require('string');
+require('prismjs');
+require('prismjs/components/prism-wiki');
+require('to-markdown');
+
+require('../vendor/md-toc');
+require('randomcolor');
+
+var commonModule = require('./common');
+var urlpath = commonModule.urlpath;
+var noteid = commonModule.noteid;
+var debug = commonModule.debug;
+var version = commonModule.version;
+var serverurl = commonModule.serverurl;
+var GOOGLE_API_KEY = commonModule.GOOGLE_API_KEY;
+var GOOGLE_CLIENT_ID = commonModule.GOOGLE_CLIENT_ID;
+var DROPBOX_APP_KEY = commonModule.DROPBOX_APP_KEY;
+var noteurl = commonModule.noteurl;
+
+var extraModule = require('./extra');
+var md = extraModule.md;
+var createtime = extraModule.createtime;
+var updateLastChange = extraModule.updateLastChange;
+var postProcess = extraModule.postProcess;
+var finishView = extraModule.finishView;
+var lastchangetime = extraModule.lastchangetime;
+var lastchangeui = extraModule.lastchangeui;
+var autoLinkify = extraModule.autoLinkify;
+var generateToc = extraModule.generateToc;
+var smoothHashScroll = extraModule.smoothHashScroll;
+var lastchangeuser = extraModule.lastchangeuser;
+var deduplicatedHeaderId = extraModule.deduplicatedHeaderId;
+var renderTOC = extraModule.renderTOC;
+var renderTitle = extraModule.renderTitle;
+var renderFilename = extraModule.renderFilename;
+var scrollToHash = extraModule.scrollToHash;
+
+var render = require('./render');
+
var body = $(".slides").html();
$(".slides").html(S(body).unescapeHTML().s);
diff --git a/public/js/syncscroll.js b/public/js/syncscroll.js
index 32d3f7a3..511c5000 100644
--- a/public/js/syncscroll.js
+++ b/public/js/syncscroll.js
@@ -1,5 +1,8 @@
// Inject line numbers for sync scroll.
+var extra = require('./extra');
+var md = extra.md;
+
function addPart(tokens, idx) {
if (tokens[idx].map && tokens[idx].level === 0) {
var startline = tokens[idx].map[0] + 1;
@@ -71,7 +74,7 @@ md.renderer.rules.fence = function (tokens, idx, options, env, self) {
if (highlighted.indexOf('<pre') === 0) {
return highlighted + '\n';
}
-
+
if (tokens[idx].map && tokens[idx].level === 0) {
var startline = tokens[idx].map[0] + 1;
var endline = tokens[idx].map[1];
@@ -99,10 +102,12 @@ function renderContainer(tokens, idx, options, env, self) {
addPart(tokens, idx);
return self.renderToken.apply(self, arguments);
}
-md.use(window.markdownitContainer, 'success', { render: renderContainer });
-md.use(window.markdownitContainer, 'info', { render: renderContainer });
-md.use(window.markdownitContainer, 'warning', { render: renderContainer });
-md.use(window.markdownitContainer, 'danger', { render: renderContainer });
+
+var markdownitContainer = require('markdown-it-container');
+md.use(markdownitContainer, 'success', { render: renderContainer });
+md.use(markdownitContainer, 'info', { render: renderContainer });
+md.use(markdownitContainer, 'warning', { render: renderContainer });
+md.use(markdownitContainer, 'danger', { render: renderContainer });
var syncscroll = true;
@@ -240,7 +245,7 @@ function syncScrollToEdit(event, preventAnimate) {
return;
}
if (editScrolling) return;
-
+
var scrollTop = viewArea[0].scrollTop;
var lineIndex = 0;
for (var i = 0, l = scrollMap.length; i < l; i++) {
@@ -260,7 +265,7 @@ function syncScrollToEdit(event, preventAnimate) {
lineDiff = lineHeightMap[i + 1] - lineNo;
}
}
-
+
var posTo = 0;
var topDiffPercent = 0;
var posToNextDiff = 0;
@@ -269,7 +274,7 @@ function syncScrollToEdit(event, preventAnimate) {
var preLastLineHeight = scrollInfo.height - scrollInfo.clientHeight - textHeight;
var preLastLineNo = Math.round(preLastLineHeight / textHeight);
var preLastLinePos = scrollMap[preLastLineNo];
-
+
if (scrollInfo.height > scrollInfo.clientHeight && scrollTop >= preLastLinePos) {
posTo = preLastLineHeight;
topDiffPercent = (scrollTop - preLastLinePos) / (viewBottom - preLastLinePos);
@@ -281,7 +286,7 @@ function syncScrollToEdit(event, preventAnimate) {
posToNextDiff = textHeight * lineDiff * topDiffPercent;
posTo += Math.ceil(posToNextDiff);
}
-
+
if (preventAnimate) {
editArea.scrollTop(posTo);
} else {
@@ -292,7 +297,7 @@ function syncScrollToEdit(event, preventAnimate) {
scrollTop: posTo
}, duration, "linear");
}
-
+
viewScrolling = true;
clearTimeout(viewScrollingTimer);
viewScrollingTimer = setTimeout(viewScrollingTimeoutInner, duration * 1.5);
@@ -322,7 +327,7 @@ function syncScrollToView(event, preventAnimate) {
return;
}
if (viewScrolling) return;
-
+
var lineNo, posTo;
var topDiffPercent, posToNextDiff;
var scrollInfo = editor.getScrollInfo();
@@ -341,7 +346,7 @@ function syncScrollToView(event, preventAnimate) {
posToNextDiff = (scrollMap[lineNo + 1] - posTo) * topDiffPercent;
posTo += Math.floor(posToNextDiff);
}
-
+
if (preventAnimate) {
viewArea.scrollTop(posTo);
} else {
@@ -352,7 +357,7 @@ function syncScrollToView(event, preventAnimate) {
scrollTop: posTo
}, duration, "linear");
}
-
+
editScrolling = true;
clearTimeout(editScrollingTimer);
editScrollingTimer = setTimeout(editScrollingTimeoutInner, duration * 1.5);
@@ -360,4 +365,11 @@ function syncScrollToView(event, preventAnimate) {
function editScrollingTimeoutInner() {
editScrolling = false;
-} \ No newline at end of file
+}
+
+module.exports = {
+ setupSyncAreas: setupSyncAreas,
+ clearMap: clearMap,
+ syncScrollToEdit: syncScrollToEdit,
+ syncScrollToView: syncScrollToView
+};
diff --git a/public/vendor/codemirror-spell-checker/spell-checker.min.js b/public/vendor/codemirror-spell-checker/spell-checker.min.js
index 4e3921a6..d5dd34d7 100644
--- a/public/vendor/codemirror-spell-checker/spell-checker.min.js
+++ b/public/vendor/codemirror-spell-checker/spell-checker.min.js
@@ -4,4 +4,4 @@
* @link https://github.com/NextStepWebs/codemirror-spell-checker
* @license MIT
*/
-"use strict";var Typo=function(e,t,r,n){if(n=n||{},this.platform=n.platform||"chrome",this.dictionary=null,this.rules={},this.dictionaryTable={},this.compoundRules=[],this.compoundRuleCodes={},this.replacementTable=[],this.flags=n.flags||{},e){if(this.dictionary=e,"chrome"==this.platform)t||(t=this._readFile(chrome.extension.getURL("lib/typo/dictionaries/"+e+"/"+e+".aff"))),r||(r=this._readFile(chrome.extension.getURL("lib/typo/dictionaries/"+e+"/"+e+".dic")));else{var i=n.dictionaryPath||"";t||(t=this._readFile(i+"/"+e+"/"+e+".aff")),r||(r=this._readFile(i+"/"+e+"/"+e+".dic"))}this.rules=this._parseAFF(t),this.compoundRuleCodes={};for(var a=0,s=this.compoundRules.length;s>a;a++)for(var o=this.compoundRules[a],l=0,u=o.length;u>l;l++)this.compoundRuleCodes[o[l]]=[];"ONLYINCOMPOUND"in this.flags&&(this.compoundRuleCodes[this.flags.ONLYINCOMPOUND]=[]),this.dictionaryTable=this._parseDIC(r);for(var a in this.compoundRuleCodes)0==this.compoundRuleCodes[a].length&&delete this.compoundRuleCodes[a];for(var a=0,s=this.compoundRules.length;s>a;a++){for(var h=this.compoundRules[a],c="",l=0,u=h.length;u>l;l++){var p=h[l];c+=p in this.compoundRuleCodes?"("+this.compoundRuleCodes[p].join("|")+")":p}this.compoundRules[a]=RegExp(c,"i")}}return this};Typo.prototype={load:function(e){for(var t in e)this[t]=e[t];return this},_readFile:function(e,t){t||(t="ISO8859-1");var r=new XMLHttpRequest;return r.open("GET",e,!1),r.overrideMimeType&&r.overrideMimeType("text/plain; charset="+t),r.send(null),r.responseText},_parseAFF:function(e){var t={};e=this._removeAffixComments(e);for(var r=e.split("\n"),n=0,i=r.length;i>n;n++){var a=r[n],s=a.split(/\s+/),o=s[0];if("PFX"==o||"SFX"==o){for(var l=s[1],u=s[2],h=parseInt(s[3],10),c=[],p=n+1,f=n+1+h;f>p;p++){var a=r[p],d=a.split(/\s+/),v=d[2],g=d[3].split("/"),m=g[0];"0"===m&&(m="");var y=this.parseRuleCodes(g[1]),_=d[4],C={};C.add=m,y.length>0&&(C.continuationClasses=y),"."!==_&&(C.match=RegExp("SFX"===o?_+"$":"^"+_)),"0"!=v&&(C.remove="SFX"===o?RegExp(v+"$"):v),c.push(C)}t[l]={type:o,combineable:"Y"==u,entries:c},n+=h}else if("COMPOUNDRULE"===o){for(var h=parseInt(s[1],10),p=n+1,f=n+1+h;f>p;p++){var a=r[p],d=a.split(/\s+/);this.compoundRules.push(d[1])}n+=h}else if("REP"===o){var d=a.split(/\s+/);3===d.length&&this.replacementTable.push([d[1],d[2]])}else this.flags[o]=s[1]}return t},_removeAffixComments:function(e){return e=e.replace(/#.*$/gm,""),e=e.replace(/^\s\s*/m,"").replace(/\s\s*$/m,""),e=e.replace(/\n{2,}/g,"\n"),e=e.replace(/^\s\s*/,"").replace(/\s\s*$/,"")},_parseDIC:function(e){function t(e,t){e in n&&"object"==typeof n[e]||(n[e]=[]),n[e].push(t)}e=this._removeDicComments(e);for(var r=e.split("\n"),n={},i=1,a=r.length;a>i;i++){var s=r[i],o=s.split("/",2),l=o[0];if(o.length>1){var u=this.parseRuleCodes(o[1]);"NEEDAFFIX"in this.flags&&-1!=u.indexOf(this.flags.NEEDAFFIX)||t(l,u);for(var h=0,c=u.length;c>h;h++){var p=u[h],f=this.rules[p];if(f)for(var d=this._applyRule(l,f),v=0,g=d.length;g>v;v++){var m=d[v];if(t(m,[]),f.combineable)for(var y=h+1;c>y;y++){var _=u[y],C=this.rules[_];if(C&&C.combineable&&f.type!=C.type)for(var R=this._applyRule(m,C),b=0,F=R.length;F>b;b++){var x=R[b];t(x,[])}}}p in this.compoundRuleCodes&&this.compoundRuleCodes[p].push(l)}}else t(l.trim(),[])}return n},_removeDicComments:function(e){return e=e.replace(/^\t.*$/gm,"")},parseRuleCodes:function(e){if(!e)return[];if(!("FLAG"in this.flags))return e.split("");if("long"===this.flags.FLAG){for(var t=[],r=0,n=e.length;n>r;r+=2)t.push(e.substr(r,2));return t}return"num"===this.flags.FLAG?textCode.split(","):void 0},_applyRule:function(e,t){for(var r=t.entries,n=[],i=0,a=r.length;a>i;i++){var s=r[i];if(!s.match||e.match(s.match)){var o=e;if(s.remove&&(o=o.replace(s.remove,"")),"SFX"===t.type?o+=s.add:o=s.add+o,n.push(o),"continuationClasses"in s)for(var l=0,u=s.continuationClasses.length;u>l;l++){var h=this.rules[s.continuationClasses[l]];h&&(n=n.concat(this._applyRule(o,h)))}}}return n},check:function(e){var t=e.replace(/^\s\s*/,"").replace(/\s\s*$/,"");if(this.checkExact(t))return!0;if(t.toUpperCase()===t){var r=t[0]+t.substring(1).toLowerCase();if(this.hasFlag(r,"KEEPCASE"))return!1;if(this.checkExact(r))return!0}var n=t.toLowerCase();if(n!==t){if(this.hasFlag(n,"KEEPCASE"))return!1;if(this.checkExact(n))return!0}return!1},checkExact:function(e){var t=this.dictionaryTable[e];if(void 0===t){if("COMPOUNDMIN"in this.flags&&e.length>=this.flags.COMPOUNDMIN)for(var r=0,n=this.compoundRules.length;n>r;r++)if(e.match(this.compoundRules[r]))return!0;return!1}for(var r=0,n=t.length;n>r;r++)if(!this.hasFlag(e,"ONLYINCOMPOUND",t[r]))return!0;return!1},hasFlag:function(e,t,r){if(t in this.flags){if(void 0===r)var r=Array.prototype.concat.apply([],this.dictionaryTable[e]);if(r&&-1!==r.indexOf(this.flags[t]))return!0}return!1},alphabet:"",suggest:function(e,t){function r(e){for(var t=[],r=0,n=e.length;n>r;r++){for(var i=e[r],a=[],s=0,o=i.length+1;o>s;s++)a.push([i.substring(0,s),i.substring(s,i.length)]);for(var l=[],s=0,o=a.length;o>s;s++){var h=a[s];h[1]&&l.push(h[0]+h[1].substring(1))}for(var c=[],s=0,o=a.length;o>s;s++){var h=a[s];h[1].length>1&&c.push(h[0]+h[1][1]+h[1][0]+h[1].substring(2))}for(var p=[],s=0,o=a.length;o>s;s++){var h=a[s];if(h[1])for(var f=0,d=u.alphabet.length;d>f;f++)p.push(h[0]+u.alphabet[f]+h[1].substring(1))}for(var v=[],s=0,o=a.length;o>s;s++){var h=a[s];if(h[1])for(var f=0,d=u.alphabet.length;d>f;f++)p.push(h[0]+u.alphabet[f]+h[1])}t=t.concat(l),t=t.concat(c),t=t.concat(p),t=t.concat(v)}return t}function n(e){for(var t=[],r=0;r<e.length;r++)u.check(e[r])&&t.push(e[r]);return t}function i(e){function i(e,t){return e[1]<t[1]?-1:1}for(var a=r([e]),s=r(a),o=n(a).concat(n(s)),l={},h=0,c=o.length;c>h;h++)o[h]in l?l[o[h]]+=1:l[o[h]]=1;var p=[];for(var h in l)p.push([h,l[h]]);p.sort(i).reverse();for(var f=[],h=0,c=Math.min(t,p.length);c>h;h++)u.hasFlag(p[h][0],"NOSUGGEST")||f.push(p[h][0]);return f}if(t||(t=5),this.check(e))return[];for(var a=0,s=this.replacementTable.length;s>a;a++){var o=this.replacementTable[a];if(-1!==e.indexOf(o[0])){var l=e.replace(o[0],o[1]);if(this.check(l))return[l]}}var u=this;return u.alphabet="abcdefghijklmnopqrstuvwxyz",i(e)}};var num_loaded=0,aff_loading=!1,dic_loading=!1,aff_data="",dic_data="",typo;CodeMirror.defineMode("spell-checker",function(e){if(!aff_loading){aff_loading=!0;var t=new XMLHttpRequest;t.open("GET",serverurl+"/vendor/codemirror-spell-checker/en_US.aff",!0),t.onload=function(){4===t.readyState&&200===t.status&&(aff_data=t.responseText,num_loaded++,2==num_loaded&&(typo=new Typo("en_US",aff_data,dic_data,{platform:"any"})))},t.send(null)}if(!dic_loading){dic_loading=!0;var r=new XMLHttpRequest;r.open("GET",serverurl+"/vendor/codemirror-spell-checker/en_US.dic",!0),r.onload=function(){4===r.readyState&&200===r.status&&(dic_data=r.responseText,num_loaded++,2==num_loaded&&(typo=new Typo("en_US",aff_data,dic_data,{platform:"any"})))},r.send(null)}var n="!\"'#$%&()*+,-./:;<=>?@[\\]^_`{|}~ ",i=/^[A-Za-z][A-Za-z0-9]+$/,a={token:function(e){var t=e.peek(),r="";if(n.includes(t))return e.next(),null;for(;null!=(t=e.peek())&&!n.includes(t);)r+=t,e.next();return i.test(r)&&typo&&!typo.check(r)?"spell-error":null}},s=CodeMirror.getMode(e,e.backdrop||"text/plain");return CodeMirror.overlayMode(s,a,!0)}),String.prototype.includes||(String.prototype.includes=function(){return-1!==String.prototype.indexOf.apply(this,arguments)}); \ No newline at end of file
+"use strict";var Typo=function(e,t,r,n){if(n=n||{},this.platform=n.platform||"chrome",this.dictionary=null,this.rules={},this.dictionaryTable={},this.compoundRules=[],this.compoundRuleCodes={},this.replacementTable=[],this.flags=n.flags||{},e){if(this.dictionary=e,"chrome"==this.platform)t||(t=this._readFile(chrome.extension.getURL("lib/typo/dictionaries/"+e+"/"+e+".aff"))),r||(r=this._readFile(chrome.extension.getURL("lib/typo/dictionaries/"+e+"/"+e+".dic")));else{var i=n.dictionaryPath||"";t||(t=this._readFile(i+"/"+e+"/"+e+".aff")),r||(r=this._readFile(i+"/"+e+"/"+e+".dic"))}this.rules=this._parseAFF(t),this.compoundRuleCodes={};for(var a=0,s=this.compoundRules.length;s>a;a++)for(var o=this.compoundRules[a],l=0,u=o.length;u>l;l++)this.compoundRuleCodes[o[l]]=[];"ONLYINCOMPOUND"in this.flags&&(this.compoundRuleCodes[this.flags.ONLYINCOMPOUND]=[]),this.dictionaryTable=this._parseDIC(r);for(var a in this.compoundRuleCodes)0==this.compoundRuleCodes[a].length&&delete this.compoundRuleCodes[a];for(var a=0,s=this.compoundRules.length;s>a;a++){for(var h=this.compoundRules[a],c="",l=0,u=h.length;u>l;l++){var p=h[l];c+=p in this.compoundRuleCodes?"("+this.compoundRuleCodes[p].join("|")+")":p}this.compoundRules[a]=RegExp(c,"i")}}return this};Typo.prototype={load:function(e){for(var t in e)this[t]=e[t];return this},_readFile:function(e,t){t||(t="ISO8859-1");var r=new XMLHttpRequest;return r.open("GET",e,!1),r.overrideMimeType&&r.overrideMimeType("text/plain; charset="+t),r.send(null),r.responseText},_parseAFF:function(e){var t={};e=this._removeAffixComments(e);for(var r=e.split("\n"),n=0,i=r.length;i>n;n++){var a=r[n],s=a.split(/\s+/),o=s[0];if("PFX"==o||"SFX"==o){for(var l=s[1],u=s[2],h=parseInt(s[3],10),c=[],p=n+1,f=n+1+h;f>p;p++){var a=r[p],d=a.split(/\s+/),v=d[2],g=d[3].split("/"),m=g[0];"0"===m&&(m="");var y=this.parseRuleCodes(g[1]),_=d[4],C={};C.add=m,y.length>0&&(C.continuationClasses=y),"."!==_&&(C.match=RegExp("SFX"===o?_+"$":"^"+_)),"0"!=v&&(C.remove="SFX"===o?RegExp(v+"$"):v),c.push(C)}t[l]={type:o,combineable:"Y"==u,entries:c},n+=h}else if("COMPOUNDRULE"===o){for(var h=parseInt(s[1],10),p=n+1,f=n+1+h;f>p;p++){var a=r[p],d=a.split(/\s+/);this.compoundRules.push(d[1])}n+=h}else if("REP"===o){var d=a.split(/\s+/);3===d.length&&this.replacementTable.push([d[1],d[2]])}else this.flags[o]=s[1]}return t},_removeAffixComments:function(e){return e=e.replace(/#.*$/gm,""),e=e.replace(/^\s\s*/m,"").replace(/\s\s*$/m,""),e=e.replace(/\n{2,}/g,"\n"),e=e.replace(/^\s\s*/,"").replace(/\s\s*$/,"")},_parseDIC:function(e){function t(e,t){e in n&&"object"==typeof n[e]||(n[e]=[]),n[e].push(t)}e=this._removeDicComments(e);for(var r=e.split("\n"),n={},i=1,a=r.length;a>i;i++){var s=r[i],o=s.split("/",2),l=o[0];if(o.length>1){var u=this.parseRuleCodes(o[1]);"NEEDAFFIX"in this.flags&&-1!=u.indexOf(this.flags.NEEDAFFIX)||t(l,u);for(var h=0,c=u.length;c>h;h++){var p=u[h],f=this.rules[p];if(f)for(var d=this._applyRule(l,f),v=0,g=d.length;g>v;v++){var m=d[v];if(t(m,[]),f.combineable)for(var y=h+1;c>y;y++){var _=u[y],C=this.rules[_];if(C&&C.combineable&&f.type!=C.type)for(var R=this._applyRule(m,C),b=0,F=R.length;F>b;b++){var x=R[b];t(x,[])}}}p in this.compoundRuleCodes&&this.compoundRuleCodes[p].push(l)}}else t(l.trim(),[])}return n},_removeDicComments:function(e){return e=e.replace(/^\t.*$/gm,"")},parseRuleCodes:function(e){if(!e)return[];if(!("FLAG"in this.flags))return e.split("");if("long"===this.flags.FLAG){for(var t=[],r=0,n=e.length;n>r;r+=2)t.push(e.substr(r,2));return t}return"num"===this.flags.FLAG?textCode.split(","):void 0},_applyRule:function(e,t){for(var r=t.entries,n=[],i=0,a=r.length;a>i;i++){var s=r[i];if(!s.match||e.match(s.match)){var o=e;if(s.remove&&(o=o.replace(s.remove,"")),"SFX"===t.type?o+=s.add:o=s.add+o,n.push(o),"continuationClasses"in s)for(var l=0,u=s.continuationClasses.length;u>l;l++){var h=this.rules[s.continuationClasses[l]];h&&(n=n.concat(this._applyRule(o,h)))}}}return n},check:function(e){var t=e.replace(/^\s\s*/,"").replace(/\s\s*$/,"");if(this.checkExact(t))return!0;if(t.toUpperCase()===t){var r=t[0]+t.substring(1).toLowerCase();if(this.hasFlag(r,"KEEPCASE"))return!1;if(this.checkExact(r))return!0}var n=t.toLowerCase();if(n!==t){if(this.hasFlag(n,"KEEPCASE"))return!1;if(this.checkExact(n))return!0}return!1},checkExact:function(e){var t=this.dictionaryTable[e];if(void 0===t){if("COMPOUNDMIN"in this.flags&&e.length>=this.flags.COMPOUNDMIN)for(var r=0,n=this.compoundRules.length;n>r;r++)if(e.match(this.compoundRules[r]))return!0;return!1}for(var r=0,n=t.length;n>r;r++)if(!this.hasFlag(e,"ONLYINCOMPOUND",t[r]))return!0;return!1},hasFlag:function(e,t,r){if(t in this.flags){if(void 0===r)var r=Array.prototype.concat.apply([],this.dictionaryTable[e]);if(r&&-1!==r.indexOf(this.flags[t]))return!0}return!1},alphabet:"",suggest:function(e,t){function r(e){for(var t=[],r=0,n=e.length;n>r;r++){for(var i=e[r],a=[],s=0,o=i.length+1;o>s;s++)a.push([i.substring(0,s),i.substring(s,i.length)]);for(var l=[],s=0,o=a.length;o>s;s++){var h=a[s];h[1]&&l.push(h[0]+h[1].substring(1))}for(var c=[],s=0,o=a.length;o>s;s++){var h=a[s];h[1].length>1&&c.push(h[0]+h[1][1]+h[1][0]+h[1].substring(2))}for(var p=[],s=0,o=a.length;o>s;s++){var h=a[s];if(h[1])for(var f=0,d=u.alphabet.length;d>f;f++)p.push(h[0]+u.alphabet[f]+h[1].substring(1))}for(var v=[],s=0,o=a.length;o>s;s++){var h=a[s];if(h[1])for(var f=0,d=u.alphabet.length;d>f;f++)p.push(h[0]+u.alphabet[f]+h[1])}t=t.concat(l),t=t.concat(c),t=t.concat(p),t=t.concat(v)}return t}function n(e){for(var t=[],r=0;r<e.length;r++)u.check(e[r])&&t.push(e[r]);return t}function i(e){function i(e,t){return e[1]<t[1]?-1:1}for(var a=r([e]),s=r(a),o=n(a).concat(n(s)),l={},h=0,c=o.length;c>h;h++)o[h]in l?l[o[h]]+=1:l[o[h]]=1;var p=[];for(var h in l)p.push([h,l[h]]);p.sort(i).reverse();for(var f=[],h=0,c=Math.min(t,p.length);c>h;h++)u.hasFlag(p[h][0],"NOSUGGEST")||f.push(p[h][0]);return f}if(t||(t=5),this.check(e))return[];for(var a=0,s=this.replacementTable.length;s>a;a++){var o=this.replacementTable[a];if(-1!==e.indexOf(o[0])){var l=e.replace(o[0],o[1]);if(this.check(l))return[l]}}var u=this;return u.alphabet="abcdefghijklmnopqrstuvwxyz",i(e)}};window.num_loaded=0;var aff_loading=!1,dic_loading=!1,aff_data="",dic_data="",typo;CodeMirror.defineMode("spell-checker",function(e){if(!aff_loading){aff_loading=!0;var t=new XMLHttpRequest;t.open("GET",serverurl+"/vendor/codemirror-spell-checker/en_US.aff",!0),t.onload=function(){4===t.readyState&&200===t.status&&(aff_data=t.responseText,num_loaded++,2==num_loaded&&(typo=new Typo("en_US",aff_data,dic_data,{platform:"any"})))},t.send(null)}if(!dic_loading){dic_loading=!0;var r=new XMLHttpRequest;r.open("GET",serverurl+"/vendor/codemirror-spell-checker/en_US.dic",!0),r.onload=function(){4===r.readyState&&200===r.status&&(dic_data=r.responseText,num_loaded++,2==num_loaded&&(typo=new Typo("en_US",aff_data,dic_data,{platform:"any"})))},r.send(null)}var n="!\"'#$%&()*+,-./:;<=>?@[\\]^_`{|}~ ",i=/^[A-Za-z][A-Za-z0-9]+$/,a={token:function(e){var t=e.peek(),r="";if(n.includes(t))return e.next(),null;for(;null!=(t=e.peek())&&!n.includes(t);)r+=t,e.next();return i.test(r)&&typo&&!typo.check(r)?"spell-error":null}},s=CodeMirror.getMode(e,e.backdrop||"text/plain");return CodeMirror.overlayMode(s,a,!0)}),String.prototype.includes||(String.prototype.includes=function(){return-1!==String.prototype.indexOf.apply(this,arguments)});
diff --git a/public/views/foot.ejs b/public/views/foot.ejs
index 80c08f63..696fe3b6 100644
--- a/public/views/foot.ejs
+++ b/public/views/foot.ejs
@@ -3,83 +3,26 @@
</script>
<% if(useCDN) { %>
<script src="//cdnjs.cloudflare.com/ajax/libs/spin.js/2.3.2/spin.min.js" defer></script>
-<script src="//ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="//cdn.jsdelivr.net/velocity/1.3.1/velocity.min.js" defer></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery-mousewheel/3.1.13/jquery.mousewheel.min.js" defer></script>
-<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" defer></script>
-<script src="//cdnjs.cloudflare.com/ajax/libs/socket.io/1.5.0/socket.io.min.js" defer></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/js-yaml/3.6.1/js-yaml.min.js" defer></script>
<script type="text/javascript" src="//cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" defer></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/moment.js/2.15.1/moment-with-locales.min.js" defer></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/mermaid/6.0.0/mermaid.min.js" defer></script>
<% } else { %>
<script src="<%- url %>/vendor/spin.js/spin.min.js" defer></script>
-<script src="<%- url %>/vendor/jquery/dist/jquery.min.js"></script>
<script src="<%- url %>/vendor/velocity/velocity.min.js" defer></script>
-<script src="<%- url %>/vendor/jquery-mousewheel/jquery.mousewheel.min.js" defer></script>
-<script src="<%- url %>/vendor/bootstrap/dist/js/bootstrap.min.js" defer></script>
-<script src="<%- url %>/vendor/socket.io-client/socket.io.js" defer></script>
<script src="<%- url %>/vendor/js-yaml/dist/js-yaml.min.js" defer></script>
<script type="text/javascript" src="<%- url %>/vendor/MathJax/MathJax.js?config=TeX-AMS-MML_HTMLorMML" defer></script>
<script src="<%- url %>/vendor/moment/min/moment-with-locales.js" defer></script>
<script src="<%- url %>/vendor/mermaid/dist/mermaid.min.js" defer></script>
<% } %>
-<script src="<%- url %>/vendor/jquery-ui/jquery-ui.min.js" defer></script>
-<!--codemirror-->
-<script src="<%- url %>/vendor/codemirror/codemirror.min.js" defer></script>
-<script src="<%- url %>/vendor/inlineAttachment/inline-attachment.js" defer></script>
-<script src="<%- url %>/vendor/inlineAttachment/codemirror.inline-attachment.js" defer></script>
-<script src="<%- url %>/vendor/codemirror-spell-checker/spell-checker.min.js" defer></script>
-<!--ot-->
-<script src="<%- url %>/vendor/ot/ot.min.js" defer></script>
-<!--others-->
-<script src="<%- url %>/vendor/markdown-it/dist/markdown-it.min.js" defer></script>
-<script src="<%- url %>/vendor/markdown-it-abbr/dist/markdown-it-abbr.min.js" defer></script>
-<script src="<%- url %>/vendor/markdown-it-footnote/dist/markdown-it-footnote.min.js" defer></script>
-<script src="<%- url %>/vendor/markdown-it-deflist/dist/markdown-it-deflist.min.js" defer></script>
-<script src="<%- url %>/vendor/markdown-it-mark/dist/markdown-it-mark.min.js" defer></script>
-<script src="<%- url %>/vendor/markdown-it-ins/dist/markdown-it-ins.min.js" defer></script>
-<script src="<%- url %>/vendor/markdown-it-sub/dist/markdown-it-sub.min.js" defer></script>
-<script src="<%- url %>/vendor/markdown-it-sup/dist/markdown-it-sup.min.js" defer></script>
-<script src="<%- url %>/vendor/markdown-it-container/dist/markdown-it-container.min.js" defer></script>
-<script src="<%- url %>/vendor/markdown-it-mathjax.js" defer></script>
-<script src="<%- url %>/vendor/markdown-it-regexp.js" defer></script>
-<script src="<%- url %>/vendor/markdown-it-imsize.js" defer></script>
-<script src="<%- url %>/vendor/gist-embed/gist-embed.min.js" defer></script>
-<script src="<%- url %>/vendor/lz-string/libs/lz-string.min.js" defer></script>
-<script src="<%- url %>/vendor/xss/dist/xss.min.js" defer></script>
-<script src="<%- url %>/vendor/string/dist/string.min.js" defer></script>
-<script src="<%- url %>/vendor/highlightjs/highlight.pack.min.js" defer></script>
-<script src="<%- url %>/vendor/prism/prism.js" defer></script>
-<script src="<%- url %>/vendor/prism/components/prism-wiki.min.js" defer></script>
-<script src="<%- url %>/vendor/js-cookie/src/js.cookie.js" defer></script>
-<script src="<%- url %>/vendor/handlebars/handlebars.min.js" defer></script>
-<script src="<%- url %>/vendor/emojify/js/emojify.min.js" defer></script>
-<script src="<%- url %>/vendor/to-markdown/dist/to-markdown.js" defer></script>
-<script src="<%- url %>/vendor/raphael/raphael.min.js" defer></script>
-<script src="<%- url %>/vendor/lodash/dist/lodash.min.js" defer></script>
-<script src="<%- url %>/vendor/sequence-diagrams/sequence-diagram-min.js" defer></script>
-<script src="<%- url %>/vendor/flowchart/release/flowchart.min.js" defer></script>
-<script src="<%- url %>/vendor/viz.js/viz.js" defer></script>
-<script src="<%- url %>/vendor/pdfobject/pdfobject.min.js" defer></script>
-<script src="<%- url %>/vendor/file-saver/FileSaver.min.js" defer></script>
-<script src="<%- url %>/vendor/store-js/store.min.js" defer></script>
-<script src="<%- url %>/vendor/js-url/url.min.js" defer></script>
-<script src="<%- url %>/vendor/jquery-textcomplete/jquery.textcomplete.js" defer></script>
-<script src="<%- url %>/vendor/Idle.Js/build/idle.min.js" defer></script>
-<script src="<%- url %>/vendor/visibilityjs/lib/visibility.core.js" defer></script>
-<script src="<%- url %>/vendor/list.js/dist/list.min.js" defer></script>
-<script src="<%- url %>/vendor/md-toc.js" defer></script>
-<script src="<%- url %>/vendor/showup/showup.js" defer></script>
-<script src="<%- url %>/vendor/randomcolor/randomColor.js" defer></script>
-<script src="<%- url %>/vendor/keymaster/keymaster.js" defer></script>
+<script src="//ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
+<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" defer></script>
+<script src="//cdnjs.cloudflare.com/ajax/libs/lodash.js/4.16.4/lodash.min.js" defer></script>
+<script src="//cdnjs.cloudflare.com/ajax/libs/socket.io/1.5.0/socket.io.min.js" defer></script>
+<script src="//cdnjs.cloudflare.com/ajax/libs/viz.js/1.3.0/viz.js" defer></script>
+<%- include build/index-scripts %>
<script src="<%- url %>/js/google-drive-upload.js" defer></script>
<script src="<%- url %>/js/google-drive-picker.js" defer></script>
-<script src="<%- url %>/js/config.js" defer></script>
-<script src="<%- url %>/js/common.js" defer></script>
-<script src="<%- url %>/js/extra.js" defer></script>
-<script src="<%- url %>/js/render.js" defer></script>
-<script src="<%- url %>/js/history.js" defer></script>
<script src="<%- url %>/js/reveal-markdown.js" defer></script>
-<script src="<%- url %>/js/syncscroll.js" defer></script>
-<script src="<%- url %>/js/index.js" defer></script> \ No newline at end of file
diff --git a/public/views/head.ejs b/public/views/head.ejs
index 5d8e44b6..67884495 100644
--- a/public/views/head.ejs
+++ b/public/views/head.ejs
@@ -8,18 +8,16 @@
<link rel="icon" type="image/png" href="<%- url %>/favicon.png">
<link rel="apple-touch-icon" href="<%- url %>/apple-touch-icon.png">
<% if(useCDN) { %>
-<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
-<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css">
<link rel="stylesheet" href="//cdn.jsdelivr.net/ionicons/2.0.1/css/ionicons.min.css">
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/octicons/3.5.0/octicons.min.css">
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/bootstrap-social/4.9.0/bootstrap-social.min.css">
<% } else { %>
-<link rel="stylesheet" href="<%- url %>/vendor/bootstrap/dist/css/bootstrap.min.css">
-<link rel="stylesheet" href="<%- url %>/vendor/font-awesome/css/font-awesome.min.css">
<link rel="stylesheet" href="<%- url %>/vendor/Ionicons/css/ionicons.min.css">
<link rel="stylesheet" href="<%- url %>/vendor/octicons/octicons/octicons.css">
<link rel="stylesheet" href="<%- url %>/css/bootstrap-social.css">
<% } %>
+<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
+<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css">
<link rel="stylesheet" href="<%- url %>/vendor/jquery-ui/jquery-ui.min.css">
<link rel="stylesheet" href="<%- url %>/vendor/codemirror/lib/codemirror.css">
<link rel="stylesheet" href="<%- url %>/vendor/codemirror-spell-checker/spell-checker.min.css">
@@ -33,12 +31,11 @@
<link rel="stylesheet" href="<%- url %>/vendor/codemirror/mode/tiddlywiki/tiddlywiki.css">
<link rel="stylesheet" href="<%- url %>/vendor/codemirror/mode/mediawiki/mediawiki.css">
<link rel="stylesheet" href="<%- url %>/css/github-extract.css">
-<link rel="stylesheet" href="<%- url %>/vendor/highlightjs/styles/github-gist.css">
-<link rel="stylesheet" href="<%- url %>/vendor/prism/themes/prism.css">
<link rel="stylesheet" href="<%- url %>/vendor/emojify/css/emojify.min.css">
<link rel="stylesheet" href="<%- url %>/vendor/showup/showup.css">
<link rel="stylesheet" href="<%- url %>/css/mermaid.css">
<link rel="stylesheet" href="<%- url %>/css/markdown.css">
+<%- include build/index-header %>
<link rel="stylesheet" href="<%- url %>/css/index.css">
<link rel="stylesheet" href="<%- url %>/css/extra.css">
<link rel="stylesheet" href="<%- url %>/css/slide-preview.css">
diff --git a/public/views/includes/header.ejs b/public/views/includes/header.ejs
new file mode 100644
index 00000000..89f3a0d1
--- /dev/null
+++ b/public/views/includes/header.ejs
@@ -0,0 +1,3 @@
+<% for (var css in htmlWebpackPlugin.files.css) { %>
+<link href="<%= htmlWebpackPlugin.files.css[css] %>" rel="stylesheet">
+<% } %>
diff --git a/public/views/includes/scripts.ejs b/public/views/includes/scripts.ejs
new file mode 100644
index 00000000..4eec75e8
--- /dev/null
+++ b/public/views/includes/scripts.ejs
@@ -0,0 +1,3 @@
+<% for (var chunk in htmlWebpackPlugin.files.chunks) { %>
+<script src="<%= htmlWebpackPlugin.files.chunks[chunk].entry %>" defer></script>
+<% } %>
diff --git a/public/views/index.ejs b/public/views/index.ejs
index 4fdee8cf..0bc3dd50 100644
--- a/public/views/index.ejs
+++ b/public/views/index.ejs
@@ -27,6 +27,7 @@
<link rel="stylesheet" href="<%- url %>/vendor/select2/select2.css">
<link rel="stylesheet" href="<%- url %>/vendor/select2/select2-bootstrap.css">
<!-- Custom styles for this template -->
+ <%- include build/cover-header %>
<link rel="stylesheet" href="<%- url %>/css/cover.css">
<link rel="stylesheet" href="<%- url %>/css/site.css">
</head>
@@ -194,31 +195,18 @@
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<% if(useCDN) { %>
- <script src="//ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js" defer></script>
<script src="//cdn.jsdelivr.net/velocity/1.3.1/velocity.min.js" defer></script>
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" defer></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/select2/3.5.2/select2.min.js" defer></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/moment.js/2.15.1/moment-with-locales.min.js" defer></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/js-url/2.3.0/url.min.js" defer></script>
<% } else { %>
- <script src="<%- url %>/vendor/jquery/dist/jquery.min.js" defer></script>
<script src="<%- url %>/vendor/velocity/velocity.min.js" defer></script>
- <script src="<%- url %>/vendor/bootstrap/dist/js/bootstrap.min.js" defer></script>
- <script src="<%- url %>/vendor/select2/select2.min.js" defer></script>
<script src="<%- url %>/vendor/moment/min/moment-with-locales.min.js" defer></script>
- <script src="<%- url %>/vendor/js-url/url.min.js" defer></script>
<% } %>
- <script src="<%- url %>/vendor/js-cookie/src/js.cookie.js" defer></script>
- <script src="<%- url %>/vendor/list.js/dist/list.min.js" defer></script>
- <script src="<%- url %>/vendor/list.pagination.js/dist/list.pagination.min.js" defer></script>
- <script src="<%- url %>/vendor/file-saver/FileSaver.min.js" defer></script>
- <script src="<%- url %>/vendor/store-js/store.min.js" defer></script>
- <script src="<%- url %>/vendor/lz-string/libs/lz-string.min.js" defer></script>
- <script src="<%- url %>/js/config.js" defer></script>
- <script src="<%- url %>/js/common.js" defer></script>
- <script src="<%- url %>/js/history.js" defer></script>
- <script src="<%- url %>/js/cover.js" defer></script>
- <script src="<%- url %>/js/locale.js" defer></script>
+ <script src="//ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js" defer></script>
+ <script src="//cdnjs.cloudflare.com/ajax/libs/lodash.js/4.16.4/lodash.min.js" defer></script>
+ <%- include build/cover-scripts %>
</body>
</html>
diff --git a/public/views/pretty.ejs b/public/views/pretty.ejs
index 79652012..0cd9e012 100644
--- a/public/views/pretty.ejs
+++ b/public/views/pretty.ejs
@@ -18,23 +18,20 @@
<link rel="icon" type="image/png" href="<%- url %>/favicon.png">
<link rel="apple-touch-icon" href="<%- url %>/apple-touch-icon.png">
<% if(useCDN) { %>
- <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
- <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/ionicons/2.0.1/css/ionicons.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/octicons/3.5.0/octicons.min.css">
<% } else { %>
- <link rel="stylesheet" href='<%- url %>/vendor/bootstrap/dist/css/bootstrap.min.css'>
- <link rel="stylesheet" href='<%- url %>/vendor/font-awesome/css/font-awesome.min.css'>
<link rel="stylesheet" href="<%- url %>/vendor/Ionicons/css/ionicons.min.css">
<link rel="stylesheet" href="<%- url %>/vendor/octicons/octicons/octicons.css">
<% } %>
+ <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
+ <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css">
<link rel="stylesheet" href='<%- url %>/css/github-extract.css'>
<link rel="stylesheet" href='<%- url %>/css/gist.css'>
- <link rel="stylesheet" href='<%- url %>/vendor/highlightjs/styles/github-gist.css'>
- <link rel="stylesheet" href="<%- url %>/vendor/prism/themes/prism.css">
<link rel="stylesheet" href="<%- url %>/css/mermaid.css">
<link rel="stylesheet" href='<%- url %>/css/markdown.css'>
<link rel="stylesheet" href='<%- url %>/vendor/emojify/css/emojify.min.css'>
+ <%- include build/pretty-header %>
<link rel="stylesheet" href='<%- url %>/css/extra.css'>
<link rel="stylesheet" href="<%- url %>/css/slide-preview.css">
<link rel="stylesheet" href='<%- url %>/css/site.css'>
@@ -92,53 +89,20 @@
MathJax.Hub.Config({ messageStyle: "none", skipStartupTypeset: true ,tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']], processEscapes: true }});
</script>
<% if(useCDN) { %>
-<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
-<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" defer></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-yaml/3.6.1/js-yaml.min.js" defer></script>
<script type="text/javascript" src="//cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" defer></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.15.1/moment-with-locales.min.js" defer></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mermaid/6.0.0/mermaid.min.js" defer></script>
<% } else { %>
-<script src="<%- url %>/vendor/jquery/dist/jquery.min.js"></script>
-<script src="<%- url %>/vendor/bootstrap/dist/js/bootstrap.min.js" defer></script>
<script src="<%- url %>/vendor/js-yaml/dist/js-yaml.min.js" defer></script>
<script type="text/javascript" src="<%- url %>/vendor/MathJax/MathJax.js?config=TeX-AMS-MML_HTMLorMML" defer></script>
<script src="<%- url %>/vendor/moment/min/moment-with-locales.js" defer></script>
<script src="<%- url %>/vendor/mermaid/dist/mermaid.min.js" defer></script>
<% } %>
-<script src="<%- url %>/vendor/lz-string/libs/lz-string.min.js" defer></script>
-<script src="<%- url %>/vendor/xss/dist/xss.min.js" defer></script>
-<script src="<%- url %>/vendor/markdown-it/dist/markdown-it.min.js" defer></script>
-<script src="<%- url %>/vendor/markdown-it-abbr/dist/markdown-it-abbr.min.js" defer></script>
-<script src="<%- url %>/vendor/markdown-it-footnote/dist/markdown-it-footnote.min.js" defer></script>
-<script src="<%- url %>/vendor/markdown-it-deflist/dist/markdown-it-deflist.min.js" defer></script>
-<script src="<%- url %>/vendor/markdown-it-mark/dist/markdown-it-mark.min.js" defer></script>
-<script src="<%- url %>/vendor/markdown-it-ins/dist/markdown-it-ins.min.js" defer></script>
-<script src="<%- url %>/vendor/markdown-it-sub/dist/markdown-it-sub.min.js" defer></script>
-<script src="<%- url %>/vendor/markdown-it-sup/dist/markdown-it-sup.min.js" defer></script>
-<script src="<%- url %>/vendor/markdown-it-container/dist/markdown-it-container.min.js" defer></script>
-<script src="<%- url %>/vendor/markdown-it-mathjax.js" defer></script>
-<script src="<%- url %>/vendor/markdown-it-regexp.js" defer></script>
-<script src="<%- url %>/vendor/markdown-it-imsize.js" defer></script>
-<script src="<%- url %>/vendor/gist-embed/gist-embed.min.js" defer></script>
-<script src="<%- url %>/vendor/string/dist/string.min.js" defer></script>
-<script src="<%- url %>/vendor/highlightjs/highlight.pack.min.js" defer></script>
-<script src="<%- url %>/vendor/prism/prism.js" defer></script>
-<script src="<%- url %>/vendor/prism/components/prism-wiki.min.js" defer></script>
-<script src="<%- url %>/vendor/js-cookie/src/js.cookie.js" defer></script>
-<script src="<%- url %>/vendor/emojify/js/emojify.min.js" defer></script>
-<script src="<%- url %>/vendor/raphael/raphael.min.js" defer></script>
-<script src="<%- url %>/vendor/lodash/dist/lodash.min.js" defer></script>
-<script src="<%- url %>/vendor/sequence-diagrams/sequence-diagram-min.js" defer></script>
-<script src="<%- url %>/vendor/flowchart/release/flowchart.min.js" defer></script>
-<script src="<%- url %>/vendor/viz.js/viz.js" defer></script>
-<script src="<%- url %>/vendor/pdfobject/pdfobject.min.js" defer></script>
-<script src="<%- url %>/vendor/md-toc.js" defer></script>
-<script src="<%- url %>/js/config.js" defer></script>
-<script src="<%- url %>/js/common.js" defer></script>
-<script src="<%- url %>/js/extra.js" defer></script>
-<script src="<%- url %>/js/render.js" defer></script>
+<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" defer></script>
+<script src="//ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
+<script src="//cdnjs.cloudflare.com/ajax/libs/lodash.js/4.16.4/lodash.min.js" defer></script>
+<script src="//cdnjs.cloudflare.com/ajax/libs/viz.js/1.3.0/viz.js" defer></script>
+<%- include build/pretty-scripts %>
<script src="<%- url %>/js/reveal-markdown.js" defer></script>
-<script src="<%- url %>/js/pretty.js" defer></script>
-
-<%- include ga %> \ No newline at end of file
+<%- include ga %>
diff --git a/public/views/slide.ejs b/public/views/slide.ejs
index 443e1468..79d77086 100644
--- a/public/views/slide.ejs
+++ b/public/views/slide.ejs
@@ -87,55 +87,25 @@
MathJax.Hub.Config({ messageStyle: "none", skipStartupTypeset: true ,tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']], processEscapes: true }});
</script>
<% if(useCDN) { %>
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="//cdn.jsdelivr.net/velocity/1.3.1/velocity.min.js" defer></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-yaml/3.6.1/js-yaml.min.js" defer></script>
<script type="text/javascript" src="//cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" defer></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.15.1/moment-with-locales.min.js" defer></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mermaid/6.0.0/mermaid.min.js" defer></script>
<% } else { %>
- <script src="<%- url %>/vendor/jquery/dist/jquery.min.js"></script>
+ <script src="<%- url %>/vendor/reveal.js/lib/js/head.min.js"></script>
+ <script src="<%- url %>/vendor/reveal.js/js/reveal.js"></script>
<script src="<%- url %>/vendor/velocity/velocity.min.js" defer></script>
<script src="<%- url %>/vendor/js-yaml/dist/js-yaml.min.js" defer></script>
<script type="text/javascript" src="<%- url %>/vendor/MathJax/MathJax.js?config=TeX-AMS-MML_HTMLorMML" defer></script>
<script src="<%- url %>/vendor/moment/min/moment-with-locales.js" defer></script>
<script src="<%- url %>/vendor/mermaid/dist/mermaid.min.js" defer></script>
<% } %>
- <script src="<%- url %>/vendor/bootstrap/tooltip.min.js"></script>
- <script src="<%- url %>/vendor/reveal.js/lib/js/head.min.js"></script>
- <script src="<%- url %>/vendor/reveal.js/js/reveal.js"></script>
- <script src="<%- url %>/vendor/xss/dist/xss.min.js" defer></script>
- <script src="<%- url %>/vendor/markdown-it/dist/markdown-it.min.js" defer></script>
- <script src="<%- url %>/vendor/markdown-it-abbr/dist/markdown-it-abbr.min.js" defer></script>
- <script src="<%- url %>/vendor/markdown-it-footnote/dist/markdown-it-footnote.min.js" defer></script>
- <script src="<%- url %>/vendor/markdown-it-deflist/dist/markdown-it-deflist.min.js" defer></script>
- <script src="<%- url %>/vendor/markdown-it-mark/dist/markdown-it-mark.min.js" defer></script>
- <script src="<%- url %>/vendor/markdown-it-ins/dist/markdown-it-ins.min.js" defer></script>
- <script src="<%- url %>/vendor/markdown-it-sub/dist/markdown-it-sub.min.js" defer></script>
- <script src="<%- url %>/vendor/markdown-it-sup/dist/markdown-it-sup.min.js" defer></script>
- <script src="<%- url %>/vendor/markdown-it-container/dist/markdown-it-container.min.js" defer></script>
- <script src="<%- url %>/vendor/markdown-it-mathjax.js" defer></script>
- <script src="<%- url %>/vendor/markdown-it-regexp.js" defer></script>
- <script src="<%- url %>/vendor/markdown-it-imsize.js" defer></script>
- <script src="<%- url %>/vendor/gist-embed/gist-embed.min.js" defer></script>
- <script src="<%- url %>/vendor/string/dist/string.min.js" defer></script>
- <script src="<%- url %>/vendor/highlightjs/highlight.pack.min.js" defer></script>
- <script src="<%- url %>/vendor/js-cookie/src/js.cookie.js" defer></script>
- <script src="<%- url %>/vendor/emojify/js/emojify.min.js" defer></script>
- <script src="<%- url %>/vendor/raphael/raphael.min.js" defer></script>
- <script src="<%- url %>/vendor/lodash/dist/lodash.min.js" defer></script>
- <script src="<%- url %>/vendor/sequence-diagrams/sequence-diagram-min.js" defer></script>
- <script src="<%- url %>/vendor/flowchart/release/flowchart.min.js" defer></script>
- <script src="<%- url %>/vendor/viz.js/viz.js" defer></script>
- <script src="<%- url %>/vendor/pdfobject/pdfobject.min.js" defer></script>
- <script src="<%- url %>/vendor/md-toc.js" defer></script>
- <script src="<%- url %>/js/config.js" defer></script>
- <script src="<%- url %>/js/common.js" defer></script>
- <script src="<%- url %>/js/extra.js" defer></script>
- <script src="<%- url %>/js/render.js" defer></script>
- <script src="<%- url %>/js/slide.js" defer></script>
-
+ <script src="//ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
+ <script src="//cdnjs.cloudflare.com/ajax/libs/lodash.js/4.16.4/lodash.min.js" defer></script>
+ <script src="//cdnjs.cloudflare.com/ajax/libs/viz.js/1.3.0/viz.js" defer></script>
+ <%- include build/slide-scripts %>
</body>
</html>
-<%- include ga %> \ No newline at end of file
+<%- include ga %>