summaryrefslogtreecommitdiff
path: root/public/js
diff options
context:
space:
mode:
Diffstat (limited to 'public/js')
-rw-r--r--public/js/common.js49
-rw-r--r--public/js/cover.js2
-rw-r--r--public/js/extra.js20
-rw-r--r--public/js/history.js6
-rw-r--r--public/js/index.js9
-rw-r--r--public/js/pretty.js4
-rw-r--r--public/js/slide.js18
-rw-r--r--public/js/syncscroll.js3
8 files changed, 47 insertions, 64 deletions
diff --git a/public/js/common.js b/public/js/common.js
index 19455f3d..b8ff3758 100644
--- a/public/js/common.js
+++ b/public/js/common.js
@@ -8,7 +8,7 @@ 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 : '');
+window.serverurl = window.location.protocol + '//' + (domain ? domain : window.location.hostname) + (port ? ':' + port : '') + (urlpath ? '/' + urlpath : '');
var noteid = urlpath ? window.location.pathname.slice(urlpath.length + 1, window.location.pathname.length).split('/')[1] : window.location.pathname.split('/')[1];
var noteurl = serverurl + '/' + noteid;
@@ -93,29 +93,28 @@ function checkIfAuth(yesCallback, noCallback) {
}
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,
+ 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,
+ 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
+ /* export functions */
+ resetCheckAuth: resetCheckAuth,
+ setLoginState: setLoginState,
+ checkLoginStateChanged: checkLoginStateChanged,
+ getLoginState: getLoginState,
+ getUserId: getUserId,
+ clearLoginState: clearLoginState,
+ checkIfAuth: checkIfAuth
};
diff --git a/public/js/cover.js b/public/js/cover.js
index 30a8e5c8..3dd4de09 100644
--- a/public/js/cover.js
+++ b/public/js/cover.js
@@ -1,7 +1,6 @@
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;
@@ -17,6 +16,7 @@ var postHistoryToServer = historyModule.postHistoryToServer;
var deleteServerHistory = historyModule.deleteServerHistory;
var parseServerToHistory = historyModule.parseServerToHistory;
var saveStorageHistoryToServer = historyModule.saveStorageHistoryToServer;
+var clearDuplicatedHistory = historyModule.clearDuplicatedHistory;
var saveAs = require('file-saver').saveAs;
var List = require('list.js');
diff --git a/public/js/extra.js b/public/js/extra.js
index 24d53fe7..7cae068e 100644
--- a/public/js/extra.js
+++ b/public/js/extra.js
@@ -5,9 +5,9 @@ var saveAs = require('file-saver').saveAs;
require('../vendor/md-toc');
//auto update last change
-var createtime = null;
-var lastchangetime = null;
-var lastchangeui = {
+window.createtime = null;
+window.lastchangetime = null;
+window.lastchangeui = {
status: $(".ui-status-lastchange"),
time: $(".ui-lastchange"),
user: $(".ui-lastchangeuser"),
@@ -30,8 +30,8 @@ function updateLastChange() {
}
setInterval(updateLastChange, 60000);
-var lastchangeuser = null;
-var lastchangeuserprofile = null;
+window.lastchangeuser = null;
+window.lastchangeuserprofile = null;
function updateLastChangeUser() {
if (lastchangeui) {
if (lastchangeuser && lastchangeuserprofile) {
@@ -544,7 +544,6 @@ function exportToRawHTML(view) {
}
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);
@@ -1070,11 +1069,7 @@ md.use(pdfPlugin);
module.exports = {
md: md,
- createtime: createtime,
- lastchangetime: lastchangetime,
updateLastChange: updateLastChange,
- lastchangeui: lastchangeui,
- lastchangeuser: lastchangeuser,
postProcess: postProcess,
finishView: finishView,
autoLinkify: autoLinkify,
@@ -1087,5 +1082,8 @@ module.exports = {
scrollToHash: scrollToHash,
owner: owner,
updateLastChangeUser: updateLastChangeUser,
- updateOwner: updateOwner
+ updateOwner: updateOwner,
+ parseMeta: parseMeta,
+ exportToHTML: exportToHTML,
+ exportToRawHTML: exportToRawHTML
};
diff --git a/public/js/history.js b/public/js/history.js
index d5082dd9..d924eec1 100644
--- a/public/js/history.js
+++ b/public/js/history.js
@@ -3,14 +3,13 @@ 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;
+window.migrateHistoryFromTempCallback = null;
migrateHistoryFromTemp();
@@ -417,5 +416,6 @@ module.exports = {
postHistoryToServer: postHistoryToServer,
deleteServerHistory: deleteServerHistory,
parseServerToHistory: parseServerToHistory,
- saveStorageHistoryToServer: saveStorageHistoryToServer
+ saveStorageHistoryToServer: saveStorageHistoryToServer,
+ clearDuplicatedHistory: clearDuplicatedHistory
}
diff --git a/public/js/index.js b/public/js/index.js
index 20a76ff1..5246f949 100644
--- a/public/js/index.js
+++ b/public/js/index.js
@@ -21,7 +21,6 @@ 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;
@@ -38,15 +37,12 @@ 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;
@@ -55,6 +51,9 @@ var scrollToHash = extra.scrollToHash;
var owner = extra.owner;
var updateLastChangeUser = extra.updateLastChangeUser;
var updateOwner = extra.updateOwner;
+var parseMeta = extra.parseMeta;
+var exportToHTML = extra.exportToHTML;
+var exportToRawHTML = extra.exportToRawHTML;
var historyModule = require('./history');
var writeHistory = historyModule.writeHistory;
@@ -757,7 +756,7 @@ function updateStatusBar() {
}
//ui vars
-var ui = {
+window.ui = {
spinner: $(".ui-spinner"),
content: $(".ui-content"),
toolbar: {
diff --git a/public/js/pretty.js b/public/js/pretty.js
index 6b551c17..c5211202 100644
--- a/public/js/pretty.js
+++ b/public/js/pretty.js
@@ -7,11 +7,11 @@ 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 parseMeta = extra.parseMeta;
var preventXSS = require('./render').preventXSS;
-var markdown = $(".markdown-body");
+var markdown = $("#doc.markdown-body");
var text = $('<textarea/>').html(markdown.html()).text();
var lastMeta = md.meta;
md.meta = {};
diff --git a/public/js/slide.js b/public/js/slide.js
index 257c60bb..2536c602 100644
--- a/public/js/slide.js
+++ b/public/js/slide.js
@@ -14,7 +14,6 @@ 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;
@@ -22,23 +21,10 @@ 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');
+
+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 511c5000..a9cfb5a0 100644
--- a/public/js/syncscroll.js
+++ b/public/js/syncscroll.js
@@ -109,7 +109,8 @@ md.use(markdownitContainer, 'info', { render: renderContainer });
md.use(markdownitContainer, 'warning', { render: renderContainer });
md.use(markdownitContainer, 'danger', { render: renderContainer });
-var syncscroll = true;
+// FIXME: expose syncscroll to window
+window.syncscroll = true;
var preventSyncScrollToEdit = false;
var preventSyncScrollToView = false;