Support set url path and use relative url, move raphael to bower and fixed minor issue in history

This commit is contained in:
Cheng-Han, Wu 2016-02-16 20:08:44 -08:00
parent 3f2f063e9b
commit b2b1be3dda
22 changed files with 222 additions and 198 deletions

View file

@ -61,6 +61,7 @@ There are some config you need to change in below files
```
./config.js --- for server settings
./public/js/index.js --- for client settings
./public/js/common.js --- for client settings
```
Client-side index.js settings
@ -70,6 +71,13 @@ Client-side index.js settings
| debug | `true` or `false` | set debug mode, show more logs |
| version | `0.3.2` | current version, must match same var in server side `config.js` |
Client-side common.js settings
---
| variables | example values | description |
| --------- | ------ | ----------- |
| domain | `localhost` | domain name |
| urlpath | `hackmd` | sub url path, like: `www.example.com/<urlpath>` |
Environment variables
---
| variables | example values | description |
@ -80,6 +88,7 @@ Environment variables
| PORT | `80` | web port |
| SSLPORT | `443` | ssl web port |
| DOMAIN | `localhost` | domain name |
| URL_PATH | `hackmd` | sub url path, like `www.example.com/<URL_PATH>` |
Server-side config.js settings
---

18
app.js
View file

@ -215,10 +215,10 @@ app.get('/auth/facebook',
//facebook auth callback
app.get('/auth/facebook/callback',
passport.authenticate('facebook', {
failureRedirect: '/'
failureRedirect: config.getserverurl()
}),
function (req, res) {
res.redirect('/');
res.redirect(config.getserverurl());
});
//twitter auth
app.get('/auth/twitter',
@ -227,10 +227,10 @@ app.get('/auth/twitter',
//twitter auth callback
app.get('/auth/twitter/callback',
passport.authenticate('twitter', {
failureRedirect: '/'
failureRedirect: config.getserverurl()
}),
function (req, res) {
res.redirect('/');
res.redirect(config.getserverurl());
});
//github auth
app.get('/auth/github',
@ -239,10 +239,10 @@ app.get('/auth/github',
//github auth callback
app.get('/auth/github/callback',
passport.authenticate('github', {
failureRedirect: '/'
failureRedirect: config.getserverurl()
}),
function (req, res) {
res.redirect('/');
res.redirect(config.getserverurl());
});
//github callback actions
app.get('/auth/github/callback/:noteId/:action', response.githubActions);
@ -253,17 +253,17 @@ app.get('/auth/dropbox',
//dropbox auth callback
app.get('/auth/dropbox/callback',
passport.authenticate('dropbox-oauth2', {
failureRedirect: '/'
failureRedirect: config.getserverurl()
}),
function (req, res) {
res.redirect('/');
res.redirect(config.getserverurl());
});
//logout
app.get('/logout', function (req, res) {
if (config.debug && req.isAuthenticated())
logger.info('user logout: ' + req.user._id);
req.logout();
res.redirect('/');
res.redirect(config.getserverurl());
});
//get history
app.get('/history', function (req, res) {

View file

@ -33,7 +33,8 @@
"js-yaml": "~3.5.2",
"to-markdown": "~1.3.0",
"lz-string": "~1.4.4",
"flowchart": "~1.6.1",
"raphael": "~2.1.4",
"flowchart": "~1.6.2",
"xss": "~0.2.10"
}
}

View file

@ -2,6 +2,7 @@
var path = require('path');
var domain = process.env.DOMAIN;
var urlpath = process.env.URL_PATH;
var testport = '3000';
var testsslport = '3001';
var port = process.env.PORT || testport;
@ -15,6 +16,7 @@ var config = {
version: '0.3.4',
domain: domain,
alloworigin: ['add here to allow origin to cross'],
urlpath: urlpath,
testport: testport,
testsslport: testsslport,
port: port,
@ -24,10 +26,14 @@ var config = {
sslcapath: ['change this'],
usessl: usessl,
getserverurl: function() {
if(usessl)
return 'https://' + domain + (sslport == 443 || !urladdport ? '' : ':' + sslport);
var url = domain;
if (usessl)
url = 'https://' + url + (sslport == 443 || !urladdport ? '' : ':' + sslport);
else
return 'http://' + domain + (port == 80 || !urladdport ? '' : ':' + port);
url = 'http://' + url + (port == 80 || !urladdport ? '' : ':' + port);
if (urlpath)
url = url + '/' + urlpath;
return url;
},
//path
tmppath: "./tmp/",

View file

@ -240,7 +240,7 @@ function getNotenameFromSocket(socket) {
return socket.disconnect(true);
}
var hostUrl = url.parse(referer);
var notename = hostUrl.pathname.split('/')[1];
var notename = config.urlpath ? hostUrl.pathname.slice(config.urlpath.length + 1, hostUrl.pathname.length).split('/')[1] : hostUrl.pathname.split('/')[1];
if (notename == config.featuresnotename) {
return notename;
}

View file

@ -68,6 +68,7 @@ function responseError(res, code, detail, msg) {
});
var template = config.errorpath;
var content = ejs.render(fs.readFileSync(template, 'utf8'), {
url: config.getserverurl(),
title: code + ' ' + detail + ' ' + msg,
cache: !config.debug,
filename: template,
@ -86,6 +87,7 @@ function showIndex(req, res, next) {
});
var template = config.indexpath;
var content = ejs.render(fs.readFileSync(template, 'utf8'), {
url: config.getserverurl(),
useCDN: config.usecdn
});
res.write(content);
@ -115,6 +117,7 @@ function responseHackMD(res, noteId) {
};
var compiled = ejs.compile(fs.readFileSync(template, 'utf8'), options);
var html = compiled({
url: config.getserverurl(),
title: title,
useCDN: config.usecdn,
robots: (meta && meta.robots) || false //default allow robots
@ -145,7 +148,7 @@ function newNote(req, res, next) {
if (err) {
return response.errorInternalError(res);
}
res.redirect("/" + LZString.compressToBase64(newId));
res.redirect(config.getserverurl() + "/" + LZString.compressToBase64(newId));
});
});
}
@ -272,6 +275,7 @@ function showPublishNote(req, res, next) {
function renderPublish(data, res) {
var template = config.prettypath;
var options = {
url: config.getserverurl(),
cache: !config.debug,
filename: template
};
@ -296,7 +300,7 @@ function actionPublish(req, res, noteId) {
if (err) {
return response.errorNotFound(res);
}
res.redirect("/s/" + note.shortid);
res.redirect(config.getserverurl() + "/s/" + note.shortid);
});
});
}
@ -311,7 +315,7 @@ function actionSlide(req, res, noteId) {
if (err) {
return response.errorNotFound(res);
}
res.redirect("/p/" + note.shortid);
res.redirect(config.getserverurl() + "/p/" + note.shortid);
});
});
}
@ -433,9 +437,9 @@ function noteActions(req, res, next) {
break;
default:
if (noteId != config.featuresnotename)
res.redirect('/' + LZString.compressToBase64(noteId));
res.redirect(config.getserverurl() + '/' + LZString.compressToBase64(noteId));
else
res.redirect('/' + noteId);
res.redirect(config.getserverurl() + '/' + noteId);
break;
}
});
@ -463,9 +467,9 @@ function publishNoteActions(req, res, next) {
switch (action) {
case "edit":
if (note.id != config.featuresnotename)
res.redirect('/' + LZString.compressToBase64(note.id));
res.redirect(config.getserverurl() + '/' + LZString.compressToBase64(note.id));
else
res.redirect('/' + note.id);
res.redirect(config.getserverurl() + '/' + note.id);
break;
}
});
@ -505,9 +509,9 @@ function githubActions(req, res, next) {
break;
default:
if (noteId != config.featuresnotename)
res.redirect('/' + LZString.compressToBase64(noteId));
res.redirect(config.getserverurl() + '/' + LZString.compressToBase64(noteId));
else
res.redirect('/' + noteId);
res.redirect(config.getserverurl() + '/' + noteId);
break;
}
});
@ -627,6 +631,7 @@ var render = function (res, title, markdown) {
var slides = md.slidify(markdown, opts);
res.end(Mustache.to_html(opts.template, {
url: config.getserverurl(),
title: title,
theme: opts.theme,
highlightTheme: opts.highlightTheme,

View file

@ -11,8 +11,8 @@
<meta name="description" content="Realtime collaborative markdown notes on all platforms.">
<meta name="author" content="jackycute">
<title>HackMD - Collaborative notes</title>
<link rel="icon" type="image/png" href="/favicon.png">
<link rel="apple-touch-icon" href="/apple-touch-icon.png">
<link rel="icon" type="image/png" href="<%- url %>/favicon.png">
<link rel="apple-touch-icon" href="<%- url %>/apple-touch-icon.png">
<!-- Bootstrap core CSS -->
<% if(useCDN) { %>
@ -20,15 +20,15 @@
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.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="/vendor/bootstrap/dist/css/bootstrap.min.css">
<link rel="stylesheet" href="/vendor/font-awesome/css/font-awesome.min.css">
<link rel="stylesheet" href="/css/bootstrap-social.css">
<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 %>/css/bootstrap-social.css">
<% } %>
<link rel="stylesheet" href="/vendor/select2/select2.css">
<link rel="stylesheet" href="/vendor/select2/select2-bootstrap.css">
<link rel="stylesheet" href="<%- url %>/vendor/select2/select2.css">
<link rel="stylesheet" href="<%- url %>/vendor/select2/select2-bootstrap.css">
<!-- Custom styles for this template -->
<link rel="stylesheet" href="/css/cover.css">
<link rel="stylesheet" href="/css/site.css">
<link rel="stylesheet" href="<%- url %>/css/cover.css">
<link rel="stylesheet" href="<%- url %>/css/site.css">
</head>
<body>
@ -61,9 +61,9 @@
<a type="button" class="btn btn-lg btn-success ui-signin" data-toggle="modal" data-target=".signin-modal" style="display:none;">Sign In</a>
<div class="ui-or" style="display:none;">Or</div>
<p class="lead">
<a href="/new" class="btn btn-lg btn-default">Start new note</a>
<a href="<%- url %>/new" class="btn btn-lg btn-default">Start new note</a>
</p>
<a href="/features">See all features here <i class="fa fa-info-circle"></i></a>
<a href="<%- url %>/features">See all features here <i class="fa fa-info-circle"></i></a>
<br> Share note via the links <i class="fa fa-link"></i> directly!
</div>
<br>
@ -78,11 +78,11 @@
</div>
<div class="ui-signout" style="display:none;">
<h4 class="ui-welcome">Welcome! <span class="ui-name"></span></h4>
<a href="/new" class="btn btn-default">Start new note</a> Or
<a href="<%- url %>/new" class="btn btn-default">Start new note</a> Or
<a href="#" class="btn btn-danger ui-logout">Sign Out</a>
<br>
<br>
<a href="/features">See all features here <i class="fa fa-info-circle"></i></a>
<a href="<%- url %>/features">See all features here <i class="fa fa-info-circle"></i></a>
<br> Share note via the links <i class="fa fa-link"></i> directly!
</div>
<hr>
@ -169,16 +169,16 @@
<h4 class="modal-title" id="mySmallModalLabel">Choose method</h4>
</div>
<div class="modal-body">
<a href="/auth/facebook" class="btn btn-lg btn-block btn-social btn-facebook">
<a href="<%- url %>/auth/facebook" class="btn btn-lg btn-block btn-social btn-facebook">
<i class="fa fa-facebook"></i> Sign in via Facebook
</a>
<a href="/auth/twitter" class="btn btn-lg btn-block btn-social btn-twitter">
<a href="<%- url %>/auth/twitter" class="btn btn-lg btn-block btn-social btn-twitter">
<i class="fa fa-twitter"></i> Sign in via Twitter
</a>
<a href="/auth/github" class="btn btn-lg btn-block btn-social btn-github">
<a href="<%- url %>/auth/github" class="btn btn-lg btn-block btn-social btn-github">
<i class="fa fa-github"></i> Sign in via GitHub
</a>
<a href="/auth/dropbox" class="btn btn-lg btn-block btn-social btn-dropbox">
<a href="<%- url %>/auth/dropbox" class="btn btn-lg btn-block btn-social btn-dropbox">
<i class="fa fa-dropbox"></i> Sign in via Dropbox
</a>
</div>
@ -219,23 +219,23 @@
<script src="//cdnjs.cloudflare.com/ajax/libs/handlebars.js/4.0.5/handlebars.min.js" defer></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/js-url/2.0.2/url.min.js" defer></script>
<% } else { %>
<script src="/vendor/jquery/dist/jquery.min.js" defer></script>
<script src="/vendor/bootstrap/dist/js/bootstrap.min.js" defer></script>
<script src="/vendor/gsap/src/minified/TweenMax.min.js" defer></script>
<script src="/vendor/gsap/src/minified/jquery.gsap.min.js" defer></script>
<script src="/vendor/select2/select2.min.js" defer></script>
<script src="/vendor/moment/min/moment-with-locales.min.js" defer></script>
<script src="/vendor/handlebars/handlebars.min.js" defer></script>
<script src="/vendor/js-url/url.min.js" defer></script>
<script src="<%- url %>/vendor/jquery/dist/jquery.min.js" defer></script>
<script src="<%- url %>/vendor/bootstrap/dist/js/bootstrap.min.js" defer></script>
<script src="<%- url %>/vendor/gsap/src/minified/TweenMax.min.js" defer></script>
<script src="<%- url %>/vendor/gsap/src/minified/jquery.gsap.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/handlebars/handlebars.min.js" defer></script>
<script src="<%- url %>/vendor/js-url/url.min.js" defer></script>
<% } %>
<script src="/vendor/js.cookie.js" defer></script>
<script src="/vendor/list.min.js" defer></script>
<script src="/vendor/FileSaver.min.js" defer></script>
<script src="/vendor/store.min.js" defer></script>
<script src="/vendor/lz-string/libs/lz-string.min.js" defer></script>
<script src="/js/common.js" defer></script>
<script src="/js/history.js" defer></script>
<script src="/js/cover.js" defer></script>
<script src="<%- url %>/vendor/js.cookie.js" defer></script>
<script src="<%- url %>/vendor/list.min.js" defer></script>
<script src="<%- url %>/vendor/FileSaver.min.js" defer></script>
<script src="<%- url %>/vendor/store.min.js" defer></script>
<script src="<%- url %>/vendor/lz-string/libs/lz-string.min.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>
</body>
</html>

View file

@ -1,5 +1,12 @@
//common
var domain = 'change this';
var domain = 'change this'; // domain name
var urlpath = ''; // sub url path, like: www.example.com/<urlpath>
var port = window.location.port;
var serverurl = window.location.protocol + '//' + domain + (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;
var checkAuth = false;
var profile = null;
var lastLoginState = getLoginState();
@ -53,7 +60,7 @@ function checkIfAuth(yesCallback, noCallback) {
if (checkLoginStateChanged())
checkAuth = false;
if (!checkAuth || typeof cookieLoginState == 'undefined') {
$.get('/me')
$.get(serverurl + '/me')
.done(function (data) {
if (data && data.status == 'ok') {
profile = data;

View file

@ -120,7 +120,7 @@ function parseHistoryCallback(list, notehistory) {
pin.removeClass('active');
}
//parse link to element a
a.attr('href', '/' + values.id);
a.attr('href', serverurl + '/' + values.id);
//parse tags
if (values.tags) {
var tags = values.tags;

View file

@ -402,10 +402,11 @@ function exportToHTML(view) {
var tocAffix = $('#toc-affix').clone();
tocAffix.find('*').removeClass('active');
//generate html via template
$.get('/css/html.min.css', function (css) {
$.get('/views/html.hbs', function (data) {
$.get(serverurl + '/css/html.min.css', function (css) {
$.get(serverurl + '/views/html.hbs', function (data) {
var template = Handlebars.compile(data);
var context = {
url: serverurl,
title: title,
css: css,
html: src[0].outerHTML,
@ -657,7 +658,7 @@ emojify.setConfig({
elements: ['script', 'textarea', 'a', 'pre', 'code', 'svg'],
classes: ['no-emojify']
},
img_dir: '/vendor/emojify/images',
img_dir: serverurl + '/vendor/emojify/images',
ignore_emoticons: true
});

View file

@ -4,7 +4,7 @@ migrateHistoryFromTemp();
function migrateHistoryFromTemp() {
if (url('#tempid')) {
$.get('/temp', {
$.get(serverurl + '/temp', {
tempid: url('#tempid')
})
.done(function (data) {
@ -57,7 +57,7 @@ function saveHistoryToCookie(notehistory) {
}
function saveHistoryToServer(notehistory) {
$.post('/history', {
$.post(serverurl + '/history', {
history: JSON.stringify(notehistory)
});
}
@ -70,7 +70,7 @@ function saveCookieHistoryToStorage(callback) {
function saveStorageHistoryToServer(callback) {
var data = store.get('notehistory');
if (data) {
$.post('/history', {
$.post(serverurl + '/history', {
history: data
})
.done(function (data) {
@ -80,7 +80,7 @@ function saveStorageHistoryToServer(callback) {
}
function saveCookieHistoryToServer(callback) {
$.post('/history', {
$.post(serverurl + '/history', {
history: Cookies.get('notehistory')
})
.done(function (data) {
@ -112,13 +112,16 @@ function clearDuplicatedHistory(notehistory) {
}
function addHistory(id, text, time, tags, pinned, notehistory) {
notehistory.push({
id: id,
text: text,
time: time,
tags: tags,
pinned: pinned
});
// only add when note id exists
if (id) {
notehistory.push({
id: id,
text: text,
time: time,
tags: tags,
pinned: pinned
});
}
return notehistory;
}
@ -145,7 +148,7 @@ function writeHistory(view) {
}
function writeHistoryToServer(view) {
$.get('/history')
$.get(serverurl + '/history')
.done(function (data) {
try {
if (data.history) {
@ -223,8 +226,9 @@ function renderHistory(view) {
tags.push(rawtags[i].innerHTML);
}
//console.debug(tags);
var id = urlpath ? location.pathname.slice(urlpath.length + 1, location.pathname.length).split('/')[1] : location.pathname.split('/')[1];
return {
id: location.pathname.split('/')[1],
id: id,
text: title,
time: moment().format('MMMM Do YYYY, h:mm:ss a'),
tags: tags
@ -260,7 +264,7 @@ function getHistory(callback) {
}
function getServerHistory(callback) {
$.get('/history')
$.get(serverurl + '/history')
.done(function (data) {
if (data.history) {
callback(data.history);
@ -301,7 +305,7 @@ function parseHistory(list, callback) {
}
function parseServerToHistory(list, callback) {
$.get('/history')
$.get(serverurl + '/history')
.done(function (data) {
if (data.history) {
parseToHistory(list, data.history, callback);
@ -340,7 +344,7 @@ function parseToHistory(list, notehistory, callback) {
notehistory[i].timestamp = moment(notehistory[i].time, 'MMMM Do YYYY, h:mm:ss a').valueOf();
notehistory[i].fromNow = moment(notehistory[i].time, 'MMMM Do YYYY, h:mm:ss a').fromNow();
notehistory[i].time = moment(notehistory[i].time, 'MMMM Do YYYY, h:mm:ss a').format('llll');
if (list.get('id', notehistory[i].id).length == 0)
if (notehistory[i].id && list.get('id', notehistory[i].id).length == 0)
list.add(notehistory[i]);
}
}

View file

@ -288,7 +288,7 @@ var statusLength = null;
var statusKeymap = null;
var statusIndent = null;
$.get('/views/statusbar.html', function (template) {
$.get(serverurl + '/views/statusbar.html', function (template) {
statusBarTemplate = template;
});
@ -994,9 +994,8 @@ function closestIndex(arr, closestTo) {
}
//button actions
var url = window.location.protocol + '//' + window.location.host + window.location.pathname;
//share
ui.toolbar.publish.attr("href", url + "/publish");
ui.toolbar.publish.attr("href", noteurl + "/publish");
//download
//markdown
ui.toolbar.download.markdown.click(function (e) {
@ -1021,7 +1020,7 @@ ui.toolbar.export.dropbox.click(function () {
var options = {
files: [
{
'url': url + "/download",
'url': noteurl + "/download",
'filename': filename
}
],
@ -1032,7 +1031,7 @@ ui.toolbar.export.dropbox.click(function () {
Dropbox.save(options);
});
//export to gist
ui.toolbar.export.gist.attr("href", url + "/gist");
ui.toolbar.export.gist.attr("href", noteurl + "/gist");
//import from dropbox
ui.toolbar.import.dropbox.click(function () {
var options = {
@ -1064,9 +1063,9 @@ ui.toc.dropdown.click(function (e) {
});
//beta
//pdf
ui.toolbar.beta.pdf.attr("download", "").attr("href", url + "/pdf");
ui.toolbar.beta.pdf.attr("download", "").attr("href", noteurl + "/pdf");
//slide
ui.toolbar.beta.slide.attr("href", url + "/slide");
ui.toolbar.beta.slide.attr("href", noteurl + "/slide");
function scrollToTop() {
if (currentMode == modeType.both) {
@ -1325,6 +1324,7 @@ function havePermission() {
//socket.io actions
var socket = io.connect({
path: urlpath ? '/' + urlpath + '/socket.io/' : '',
timeout: 10000 //10 secs to timeout
});
//overwrite original event for checking login state
@ -2450,7 +2450,7 @@ $(editor.getInputField())
checkCursorMenu();
},
template: function (value) {
return '<img class="emoji" src="/vendor/emojify/images/' + value + '.png"></img> ' + value;
return '<img class="emoji" src="' + serverurl + '/vendor/emojify/images/' + value + '.png"></img> ' + value;
},
replace: function (value) {
return ':' + value + ':';

File diff suppressed because one or more lines are too long

View file

@ -83,16 +83,16 @@
<h4 class="modal-title" id="mySmallModalLabel">Please sign in to edit</h4>
</div>
<div class="modal-body">
<a href="/auth/facebook" class="btn btn-lg btn-block btn-social btn-facebook">
<a href="<%- url %>/auth/facebook" class="btn btn-lg btn-block btn-social btn-facebook">
<i class="fa fa-facebook"></i> Sign in via Facebook
</a>
<a href="/auth/twitter" class="btn btn-lg btn-block btn-social btn-twitter">
<a href="<%- url %>/auth/twitter" class="btn btn-lg btn-block btn-social btn-twitter">
<i class="fa fa-twitter"></i> Sign in via Twitter
</a>
<a href="/auth/github" class="btn btn-lg btn-block btn-social btn-github">
<a href="<%- url %>/auth/github" class="btn btn-lg btn-block btn-social btn-github">
<i class="fa fa-github"></i> Sign in via GitHub
</a>
<a href="/auth/dropbox" class="btn btn-lg btn-block btn-social btn-dropbox">
<a href="<%- url %>/auth/dropbox" class="btn btn-lg btn-block btn-social btn-dropbox">
<i class="fa fa-dropbox"></i> Sign in via Dropbox
</a>
</div>

View file

@ -3,7 +3,7 @@
<head>
<%- include head %>
<link rel="stylesheet" href="/css/center.css">
<link rel="stylesheet" href="<%- url %>/css/center.css">
</head>
<body>

View file

@ -8,59 +8,59 @@
<script src="//cdnjs.cloudflare.com/ajax/libs/socket.io/1.3.7/socket.io.min.js" defer></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/js-yaml/3.4.6/js-yaml.min.js" defer></script>
<% } else { %>
<script src="/vendor/spin.js/spin.min.js" defer></script>
<script src="/vendor/jquery/dist/jquery.min.js"></script>
<script src="/vendor/jquery-mousewheel/jquery.mousewheel.min.js" defer></script>
<script src="/vendor/bootstrap/dist/js/bootstrap.min.js" defer></script>
<script src="/vendor/gsap/src/minified/TweenMax.min.js" defer></script>
<script src="/vendor/gsap/src/minified/jquery.gsap.min.js" defer></script>
<script src="/vendor/socket.io-client/socket.io.js" defer></script>
<script src="/vendor/js-yaml/dist/js-yaml.min.js" defer></script>
<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/jquery-mousewheel/jquery.mousewheel.min.js" defer></script>
<script src="<%- url %>/vendor/bootstrap/dist/js/bootstrap.min.js" defer></script>
<script src="<%- url %>/vendor/gsap/src/minified/TweenMax.min.js" defer></script>
<script src="<%- url %>/vendor/gsap/src/minified/jquery.gsap.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 src="/vendor/jquery-ui/jquery-ui.min.js" defer></script>
<script src="<%- url %>/vendor/jquery-ui/jquery-ui.min.js" defer></script>
<!--codemirror-->
<script src="/vendor/codemirror/codemirror.min.js" defer></script>
<script src="/vendor/inlineAttachment/inline-attachment.js" defer></script>
<script src="/vendor/inlineAttachment/codemirror.inline-attachment.js" defer></script>
<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>
<!--ot-->
<script src="/vendor/ot/ot.min.js" defer></script>
<script src="<%- url %>/vendor/ot/ot.min.js" defer></script>
<!--others-->
<script src="/vendor/remarkable.min.js" defer></script>
<script src="/vendor/remarkable-regex.js" defer></script>
<script src="/vendor/gist-embed.js" defer></script>
<script src="/vendor/lz-string/libs/lz-string.min.js" defer></script>
<script src="/vendor/xss/dist/xss.min.js" defer></script>
<script src="/vendor/string.min.js" defer></script>
<script src="/vendor/highlight-js/highlight.min.js" defer></script>
<script src="/vendor/js.cookie.js" defer></script>
<script src="/vendor/moment/min/moment-with-locales.js" defer></script>
<script src="/vendor/handlebars/handlebars.min.js" defer></script>
<script src="/vendor/emojify/js/emojify.min.js" defer></script>
<script src="/vendor/to-markdown/dist/to-markdown.js" defer></script>
<script src="/vendor/raphael-min.js" defer></script>
<script src="/vendor/lodash.min.js" defer></script>
<script src="/vendor/sequence-diagrams/sequence-diagram-min.js" defer></script>
<script src="/vendor/flowchart/release/flowchart.min.js" defer></script>
<script src="/vendor/viz.js/viz.js" defer></script>
<script src="/vendor/FileSaver.min.js" defer></script>
<script src="/vendor/store.min.js" defer></script>
<script src="/vendor/js-url/url.min.js" defer></script>
<script src="/vendor/jquery-textcomplete/jquery.textcomplete.js" defer></script>
<script src="/vendor/idle.js" defer></script>
<script src="/vendor/visibility-1.2.1.min.js" defer></script>
<script src="/vendor/list.min.js" defer></script>
<script src="/vendor/md5.min.js" defer></script>
<script src="/vendor/md-toc.js" defer></script>
<script src="/vendor/showup/showup.js" defer></script>
<script src="/vendor/randomColor.js" defer></script>
<script src="<%- url %>/vendor/remarkable.js" defer></script>
<script src="<%- url %>/vendor/remarkable-regex.js" defer></script>
<script src="<%- url %>/vendor/gist-embed.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.min.js" defer></script>
<script src="<%- url %>/vendor/highlight-js/highlight.min.js" defer></script>
<script src="<%- url %>/vendor/js.cookie.js" defer></script>
<script src="<%- url %>/vendor/moment/min/moment-with-locales.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.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/FileSaver.min.js" defer></script>
<script src="<%- url %>/vendor/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" defer></script>
<script src="<%- url %>/vendor/visibility-1.2.1.min.js" defer></script>
<script src="<%- url %>/vendor/list.min.js" defer></script>
<script src="<%- url %>/vendor/md5.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.js" defer></script>
<script type="text/javascript" src="https://www.dropbox.com/static/api/2/dropins.js" id="dropboxjs" data-app-key="rdoizrlnkuha23r" async defer></script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ messageStyle: "none", skipStartupTypeset: true ,tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']], processEscapes: true }});
</script>
<script type="text/javascript" src="//cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" defer></script>
<script src="/js/common.js" defer></script>
<script src="/js/extra.js" defer></script>
<script src="/js/render.js" defer></script>
<script src="/js/history.js" defer></script>
<script src="/js/index.js" defer></script>
<script src="/js/syncscroll.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/index.js" defer></script>
<script src="<%- url %>/js/syncscroll.js" defer></script>

View file

@ -8,34 +8,34 @@
<meta name="robots" content="<%- robots %>">
<% } %>
<title><%- title %></title>
<link rel="icon" type="image/png" href="/favicon.png">
<link rel="apple-touch-icon" href="/apple-touch-icon.png">
<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.6/css/bootstrap.min.css">
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.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="/vendor/bootstrap/dist/css/bootstrap.min.css">
<link rel="stylesheet" href="/vendor/font-awesome/css/font-awesome.min.css">
<link rel="stylesheet" href="/css/bootstrap-social.css">
<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 %>/css/bootstrap-social.css">
<% } %>
<link rel="stylesheet" href="/vendor/jquery-ui/jquery-ui.min.css">
<link rel="stylesheet" href="/vendor/codemirror/lib/codemirror.css">
<link rel="stylesheet" href="/vendor/codemirror/addon/fold/foldgutter.css">
<link rel="stylesheet" href="/vendor/codemirror/addon/display/fullscreen.css">
<link rel="stylesheet" href="/vendor/codemirror/addon/dialog/dialog.css">
<link rel="stylesheet" href="/vendor/codemirror/addon/scroll/simplescrollbars.css">
<link rel="stylesheet" href="/vendor/codemirror/addon/search/matchesonscrollbar.css">
<link rel="stylesheet" href="/vendor/codemirror/theme/monokai.css">
<link rel="stylesheet" href="/vendor/codemirror/theme/one-dark.css">
<link rel="stylesheet" href="/css/github-extract.css">
<link rel="stylesheet" href="/vendor/highlight-js/github-gist.min.css">
<link rel="stylesheet" href="/vendor/emojify/css/emojify.min.css">
<link rel="stylesheet" href="/vendor/showup/showup.css">
<link rel="stylesheet" href="/css/markdown.css">
<link rel="stylesheet" href="/css/index.css">
<link rel="stylesheet" href="/css/extra.css">
<link rel="stylesheet" href="/css/site.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/addon/fold/foldgutter.css">
<link rel="stylesheet" href="<%- url %>/vendor/codemirror/addon/display/fullscreen.css">
<link rel="stylesheet" href="<%- url %>/vendor/codemirror/addon/dialog/dialog.css">
<link rel="stylesheet" href="<%- url %>/vendor/codemirror/addon/scroll/simplescrollbars.css">
<link rel="stylesheet" href="<%- url %>/vendor/codemirror/addon/search/matchesonscrollbar.css">
<link rel="stylesheet" href="<%- url %>/vendor/codemirror/theme/monokai.css">
<link rel="stylesheet" href="<%- url %>/vendor/codemirror/theme/one-dark.css">
<link rel="stylesheet" href="<%- url %>/css/github-extract.css">
<link rel="stylesheet" href="<%- url %>/vendor/highlight-js/github-gist.min.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/markdown.css">
<link rel="stylesheet" href="<%- url %>/css/index.css">
<link rel="stylesheet" href="<%- url %>/css/extra.css">
<link rel="stylesheet" href="<%- url %>/css/site.css">
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>

View file

@ -13,7 +13,7 @@
<ul class="dropdown-menu list" role="menu" aria-labelledby="menu">
</ul>
</div>
<a class="navbar-brand" href="/"><i class="fa fa-file-text"></i> HackMD</a>
<a class="navbar-brand" href="<%- url %>"><i class="fa fa-file-text"></i> HackMD</a>
<div class="nav-mobile pull-right visible-xs">
<span class="btn btn-link btn-file ui-upload-image" title="Upload Image" style="display:none;">
<i class="fa fa-camera"></i><input type="file" accept="image/*" name="upload" multiple>
@ -22,7 +22,7 @@
<i class="fa fa-caret-down"></i>
</a>
<ul class="dropdown-menu list" role="menu" aria-labelledby="menu">
<li role="presentation"><a role="menuitem" class="ui-new" tabindex="-1" href="./new" target="_blank"><i class="fa fa-plus fa-fw"></i> New</a>
<li role="presentation"><a role="menuitem" class="ui-new" tabindex="-1" href="<%- url %>/new" target="_blank"><i class="fa fa-plus fa-fw"></i> New</a>
</li>
<li role="presentation"><a role="menuitem" class="ui-publish" tabindex="-1" href="#" target="_blank"><i class="fa fa-print fa-fw"></i> Publish</a>
</li>
@ -90,7 +90,7 @@
</ul>
<ul class="nav navbar-nav navbar-right" style="padding:0;">
<li>
<a href="./new" target="_blank" class="ui-new">
<a href="<%- url %>/new" target="_blank" class="ui-new">
<i class="fa fa-plus"></i> New
</a>
</li>

View file

@ -13,8 +13,8 @@
<title>
{{title}}
</title>
<link rel="icon" type="image/png" href="https://hackmd.io/favicon.png">
<link rel="apple-touch-icon" href="https://hackmd.io/apple-touch-icon.png">
<link rel="icon" type="image/png" href="{{{url}}}/favicon.png">
<link rel="apple-touch-icon" href="{{{url}}}/apple-touch-icon.png">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">

View file

@ -82,9 +82,10 @@
<script src="<%- url %>/vendor/gist-embed.js" defer></script>
<script src="<%- url %>/vendor/string.min.js" defer></script>
<script src="<%- url %>/vendor/highlight-js/highlight.min.js" defer></script>
<script src="<%- url %>/vendor/js.cookie.js" defer></script>
<script src="<%- url %>/vendor/moment/min/moment-with-locales.js" defer></script>
<script src="<%- url %>/vendor/emojify/js/emojify.min.js" defer></script>
<script src="<%- url %>/vendor/raphael-min.js" defer></script>
<script src="<%- url %>/vendor/raphael/raphael-min.js" defer></script>
<script src="<%- url %>/vendor/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>
@ -94,6 +95,7 @@
MathJax.Hub.Config({ messageStyle: "none", skipStartupTypeset: true ,tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']], processEscapes: true }});
</script>
<script type="text/javascript" src="//cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" 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/pretty.js" defer></script>

View file

@ -3,7 +3,7 @@
<head>
<meta charset="utf-8">
<title>Directory Listing</title>
<link rel="stylesheet" href="/vendor/reveal.js/{{{theme}}}" id="theme">
<link rel="stylesheet" href="{{{url}}}/vendor/reveal.js/{{{theme}}}" id="theme">
<style type="text/css">
body {
margin: 1em;

View file

@ -6,19 +6,19 @@
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="mobile-web-app-capable" content="yes">
<title>{{title}}</title>
<link rel="icon" type="image/png" href="https://hackmd.io/favicon.png">
<link rel="apple-touch-icon" href="https://hackmd.io/apple-touch-icon.png">
<link rel="icon" type="image/png" href="{{{url}}}/favicon.png">
<link rel="apple-touch-icon" href="{{{url}}}/apple-touch-icon.png">
<link rel="stylesheet" href="/vendor/reveal.js/css/reveal.css">
<link rel="stylesheet" href="/vendor/reveal.js/{{{theme}}}" id="theme">
<link rel="stylesheet" href="{{{url}}}/vendor/reveal.js/css/reveal.css">
<link rel="stylesheet" href="{{{url}}}/vendor/reveal.js/{{{theme}}}" id="theme">
<!-- For syntax highlighting -->
<link rel="stylesheet" href="/vendor/reveal.js/lib/css/{{{highlightTheme}}}.css">
<link rel="stylesheet" href="/css/site.css">
<link rel="stylesheet" href="/css/slide.css">
<link rel="stylesheet" href="{{{url}}}/vendor/reveal.js/lib/css/{{{highlightTheme}}}.css">
<link rel="stylesheet" href="{{{url}}}/css/site.css">
<link rel="stylesheet" href="{{{url}}}/css/slide.css">
<!-- If the query includes 'print-pdf', use the PDF print sheet -->
<script>
document.write( '<link rel="stylesheet" href="/vendor/reveal.js/css/print/' + ( window.location.search.match( /print-pdf/gi ) ? 'pdf' : 'paper' ) + '.css" type="text/css" media="print">' );
document.write( '<link rel="stylesheet" href="{{{url}}}/vendor/reveal.js/css/print/' + ( window.location.search.match( /print-pdf/gi ) ? 'pdf' : 'paper' ) + '.css" type="text/css" media="print">' );
</script>
<script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
</head>
@ -28,11 +28,11 @@
<div class="slides">{{{slides}}}</div>
</div>
<script src="/vendor/reveal.js/lib/js/head.min.js"></script>
<script src="/vendor/reveal.js/js/reveal.js"></script>
<script src="/vendor/string.min.js"></script>
<script src="/vendor/xss/dist/xss.min.js"></script>
<script src="/js/render.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/string.min.js"></script>
<script src="{{{url}}}/vendor/xss/dist/xss.min.js"></script>
<script src="{{{url}}}/js/render.js"></script>
<script>
var body = $(".slides").html();
@ -53,12 +53,12 @@
// Optional libraries used to extend on reveal.js
var deps = [
{ src: '/vendor/reveal.js/lib/js/classList.js', condition: function() { return !document.body.classList; } },
{ src: '/vendor/reveal.js/plugin/markdown/marked.js', condition: function() { return !!document.querySelector('[data-markdown]'); } },
{ src: '/js/reveal-markdown.js', condition: function() { return !!document.querySelector('[data-markdown]'); } },
{ src: '/vendor/reveal.js/plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } },
{ src: '/vendor/reveal.js/plugin/notes/notes.js', async: true, condition: function() { return !!document.body.classList; } },
{ src: '/vendor/reveal.js/plugin/math/math.js', async: true }
{ src: '{{{url}}}/vendor/reveal.js/lib/js/classList.js', condition: function() { return !document.body.classList; } },
{ src: '{{{url}}}/vendor/reveal.js/plugin/markdown/marked.js', condition: function() { return !!document.querySelector('[data-markdown]'); } },
{ src: '{{{url}}}/js/reveal-markdown.js', condition: function() { return !!document.querySelector('[data-markdown]'); } },
{ src: '{{{url}}}/vendor/reveal.js/plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } },
{ src: '{{{url}}}/vendor/reveal.js/plugin/notes/notes.js', async: true, condition: function() { return !!document.body.classList; } },
{ src: '{{{url}}}/vendor/reveal.js/plugin/math/math.js', async: true }
];
// default options to init reveal.js