Support set url path and use relative url, move raphael to bower and fixed minor issue in history
This commit is contained in:
parent
3f2f063e9b
commit
b2b1be3dda
22 changed files with 222 additions and 198 deletions
|
@ -61,6 +61,7 @@ There are some config you need to change in below files
|
||||||
```
|
```
|
||||||
./config.js --- for server settings
|
./config.js --- for server settings
|
||||||
./public/js/index.js --- for client settings
|
./public/js/index.js --- for client settings
|
||||||
|
./public/js/common.js --- for client settings
|
||||||
```
|
```
|
||||||
|
|
||||||
Client-side index.js 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 |
|
| 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` |
|
| 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
|
Environment variables
|
||||||
---
|
---
|
||||||
| variables | example values | description |
|
| variables | example values | description |
|
||||||
|
@ -80,6 +88,7 @@ Environment variables
|
||||||
| PORT | `80` | web port |
|
| PORT | `80` | web port |
|
||||||
| SSLPORT | `443` | ssl web port |
|
| SSLPORT | `443` | ssl web port |
|
||||||
| DOMAIN | `localhost` | domain name |
|
| DOMAIN | `localhost` | domain name |
|
||||||
|
| URL_PATH | `hackmd` | sub url path, like `www.example.com/<URL_PATH>` |
|
||||||
|
|
||||||
Server-side config.js settings
|
Server-side config.js settings
|
||||||
---
|
---
|
||||||
|
|
18
app.js
18
app.js
|
@ -215,10 +215,10 @@ app.get('/auth/facebook',
|
||||||
//facebook auth callback
|
//facebook auth callback
|
||||||
app.get('/auth/facebook/callback',
|
app.get('/auth/facebook/callback',
|
||||||
passport.authenticate('facebook', {
|
passport.authenticate('facebook', {
|
||||||
failureRedirect: '/'
|
failureRedirect: config.getserverurl()
|
||||||
}),
|
}),
|
||||||
function (req, res) {
|
function (req, res) {
|
||||||
res.redirect('/');
|
res.redirect(config.getserverurl());
|
||||||
});
|
});
|
||||||
//twitter auth
|
//twitter auth
|
||||||
app.get('/auth/twitter',
|
app.get('/auth/twitter',
|
||||||
|
@ -227,10 +227,10 @@ app.get('/auth/twitter',
|
||||||
//twitter auth callback
|
//twitter auth callback
|
||||||
app.get('/auth/twitter/callback',
|
app.get('/auth/twitter/callback',
|
||||||
passport.authenticate('twitter', {
|
passport.authenticate('twitter', {
|
||||||
failureRedirect: '/'
|
failureRedirect: config.getserverurl()
|
||||||
}),
|
}),
|
||||||
function (req, res) {
|
function (req, res) {
|
||||||
res.redirect('/');
|
res.redirect(config.getserverurl());
|
||||||
});
|
});
|
||||||
//github auth
|
//github auth
|
||||||
app.get('/auth/github',
|
app.get('/auth/github',
|
||||||
|
@ -239,10 +239,10 @@ app.get('/auth/github',
|
||||||
//github auth callback
|
//github auth callback
|
||||||
app.get('/auth/github/callback',
|
app.get('/auth/github/callback',
|
||||||
passport.authenticate('github', {
|
passport.authenticate('github', {
|
||||||
failureRedirect: '/'
|
failureRedirect: config.getserverurl()
|
||||||
}),
|
}),
|
||||||
function (req, res) {
|
function (req, res) {
|
||||||
res.redirect('/');
|
res.redirect(config.getserverurl());
|
||||||
});
|
});
|
||||||
//github callback actions
|
//github callback actions
|
||||||
app.get('/auth/github/callback/:noteId/:action', response.githubActions);
|
app.get('/auth/github/callback/:noteId/:action', response.githubActions);
|
||||||
|
@ -253,17 +253,17 @@ app.get('/auth/dropbox',
|
||||||
//dropbox auth callback
|
//dropbox auth callback
|
||||||
app.get('/auth/dropbox/callback',
|
app.get('/auth/dropbox/callback',
|
||||||
passport.authenticate('dropbox-oauth2', {
|
passport.authenticate('dropbox-oauth2', {
|
||||||
failureRedirect: '/'
|
failureRedirect: config.getserverurl()
|
||||||
}),
|
}),
|
||||||
function (req, res) {
|
function (req, res) {
|
||||||
res.redirect('/');
|
res.redirect(config.getserverurl());
|
||||||
});
|
});
|
||||||
//logout
|
//logout
|
||||||
app.get('/logout', function (req, res) {
|
app.get('/logout', function (req, res) {
|
||||||
if (config.debug && req.isAuthenticated())
|
if (config.debug && req.isAuthenticated())
|
||||||
logger.info('user logout: ' + req.user._id);
|
logger.info('user logout: ' + req.user._id);
|
||||||
req.logout();
|
req.logout();
|
||||||
res.redirect('/');
|
res.redirect(config.getserverurl());
|
||||||
});
|
});
|
||||||
//get history
|
//get history
|
||||||
app.get('/history', function (req, res) {
|
app.get('/history', function (req, res) {
|
||||||
|
|
|
@ -33,7 +33,8 @@
|
||||||
"js-yaml": "~3.5.2",
|
"js-yaml": "~3.5.2",
|
||||||
"to-markdown": "~1.3.0",
|
"to-markdown": "~1.3.0",
|
||||||
"lz-string": "~1.4.4",
|
"lz-string": "~1.4.4",
|
||||||
"flowchart": "~1.6.1",
|
"raphael": "~2.1.4",
|
||||||
|
"flowchart": "~1.6.2",
|
||||||
"xss": "~0.2.10"
|
"xss": "~0.2.10"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
12
config.js
12
config.js
|
@ -2,6 +2,7 @@
|
||||||
var path = require('path');
|
var path = require('path');
|
||||||
|
|
||||||
var domain = process.env.DOMAIN;
|
var domain = process.env.DOMAIN;
|
||||||
|
var urlpath = process.env.URL_PATH;
|
||||||
var testport = '3000';
|
var testport = '3000';
|
||||||
var testsslport = '3001';
|
var testsslport = '3001';
|
||||||
var port = process.env.PORT || testport;
|
var port = process.env.PORT || testport;
|
||||||
|
@ -15,6 +16,7 @@ var config = {
|
||||||
version: '0.3.4',
|
version: '0.3.4',
|
||||||
domain: domain,
|
domain: domain,
|
||||||
alloworigin: ['add here to allow origin to cross'],
|
alloworigin: ['add here to allow origin to cross'],
|
||||||
|
urlpath: urlpath,
|
||||||
testport: testport,
|
testport: testport,
|
||||||
testsslport: testsslport,
|
testsslport: testsslport,
|
||||||
port: port,
|
port: port,
|
||||||
|
@ -24,10 +26,14 @@ var config = {
|
||||||
sslcapath: ['change this'],
|
sslcapath: ['change this'],
|
||||||
usessl: usessl,
|
usessl: usessl,
|
||||||
getserverurl: function() {
|
getserverurl: function() {
|
||||||
if(usessl)
|
var url = domain;
|
||||||
return 'https://' + domain + (sslport == 443 || !urladdport ? '' : ':' + sslport);
|
if (usessl)
|
||||||
|
url = 'https://' + url + (sslport == 443 || !urladdport ? '' : ':' + sslport);
|
||||||
else
|
else
|
||||||
return 'http://' + domain + (port == 80 || !urladdport ? '' : ':' + port);
|
url = 'http://' + url + (port == 80 || !urladdport ? '' : ':' + port);
|
||||||
|
if (urlpath)
|
||||||
|
url = url + '/' + urlpath;
|
||||||
|
return url;
|
||||||
},
|
},
|
||||||
//path
|
//path
|
||||||
tmppath: "./tmp/",
|
tmppath: "./tmp/",
|
||||||
|
|
|
@ -240,7 +240,7 @@ function getNotenameFromSocket(socket) {
|
||||||
return socket.disconnect(true);
|
return socket.disconnect(true);
|
||||||
}
|
}
|
||||||
var hostUrl = url.parse(referer);
|
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) {
|
if (notename == config.featuresnotename) {
|
||||||
return notename;
|
return notename;
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,6 +68,7 @@ function responseError(res, code, detail, msg) {
|
||||||
});
|
});
|
||||||
var template = config.errorpath;
|
var template = config.errorpath;
|
||||||
var content = ejs.render(fs.readFileSync(template, 'utf8'), {
|
var content = ejs.render(fs.readFileSync(template, 'utf8'), {
|
||||||
|
url: config.getserverurl(),
|
||||||
title: code + ' ' + detail + ' ' + msg,
|
title: code + ' ' + detail + ' ' + msg,
|
||||||
cache: !config.debug,
|
cache: !config.debug,
|
||||||
filename: template,
|
filename: template,
|
||||||
|
@ -86,6 +87,7 @@ function showIndex(req, res, next) {
|
||||||
});
|
});
|
||||||
var template = config.indexpath;
|
var template = config.indexpath;
|
||||||
var content = ejs.render(fs.readFileSync(template, 'utf8'), {
|
var content = ejs.render(fs.readFileSync(template, 'utf8'), {
|
||||||
|
url: config.getserverurl(),
|
||||||
useCDN: config.usecdn
|
useCDN: config.usecdn
|
||||||
});
|
});
|
||||||
res.write(content);
|
res.write(content);
|
||||||
|
@ -115,6 +117,7 @@ function responseHackMD(res, noteId) {
|
||||||
};
|
};
|
||||||
var compiled = ejs.compile(fs.readFileSync(template, 'utf8'), options);
|
var compiled = ejs.compile(fs.readFileSync(template, 'utf8'), options);
|
||||||
var html = compiled({
|
var html = compiled({
|
||||||
|
url: config.getserverurl(),
|
||||||
title: title,
|
title: title,
|
||||||
useCDN: config.usecdn,
|
useCDN: config.usecdn,
|
||||||
robots: (meta && meta.robots) || false //default allow robots
|
robots: (meta && meta.robots) || false //default allow robots
|
||||||
|
@ -145,7 +148,7 @@ function newNote(req, res, next) {
|
||||||
if (err) {
|
if (err) {
|
||||||
return response.errorInternalError(res);
|
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) {
|
function renderPublish(data, res) {
|
||||||
var template = config.prettypath;
|
var template = config.prettypath;
|
||||||
var options = {
|
var options = {
|
||||||
|
url: config.getserverurl(),
|
||||||
cache: !config.debug,
|
cache: !config.debug,
|
||||||
filename: template
|
filename: template
|
||||||
};
|
};
|
||||||
|
@ -296,7 +300,7 @@ function actionPublish(req, res, noteId) {
|
||||||
if (err) {
|
if (err) {
|
||||||
return response.errorNotFound(res);
|
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) {
|
if (err) {
|
||||||
return response.errorNotFound(res);
|
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;
|
break;
|
||||||
default:
|
default:
|
||||||
if (noteId != config.featuresnotename)
|
if (noteId != config.featuresnotename)
|
||||||
res.redirect('/' + LZString.compressToBase64(noteId));
|
res.redirect(config.getserverurl() + '/' + LZString.compressToBase64(noteId));
|
||||||
else
|
else
|
||||||
res.redirect('/' + noteId);
|
res.redirect(config.getserverurl() + '/' + noteId);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -463,9 +467,9 @@ function publishNoteActions(req, res, next) {
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case "edit":
|
case "edit":
|
||||||
if (note.id != config.featuresnotename)
|
if (note.id != config.featuresnotename)
|
||||||
res.redirect('/' + LZString.compressToBase64(note.id));
|
res.redirect(config.getserverurl() + '/' + LZString.compressToBase64(note.id));
|
||||||
else
|
else
|
||||||
res.redirect('/' + note.id);
|
res.redirect(config.getserverurl() + '/' + note.id);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -505,9 +509,9 @@ function githubActions(req, res, next) {
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (noteId != config.featuresnotename)
|
if (noteId != config.featuresnotename)
|
||||||
res.redirect('/' + LZString.compressToBase64(noteId));
|
res.redirect(config.getserverurl() + '/' + LZString.compressToBase64(noteId));
|
||||||
else
|
else
|
||||||
res.redirect('/' + noteId);
|
res.redirect(config.getserverurl() + '/' + noteId);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -627,6 +631,7 @@ var render = function (res, title, markdown) {
|
||||||
var slides = md.slidify(markdown, opts);
|
var slides = md.slidify(markdown, opts);
|
||||||
|
|
||||||
res.end(Mustache.to_html(opts.template, {
|
res.end(Mustache.to_html(opts.template, {
|
||||||
|
url: config.getserverurl(),
|
||||||
title: title,
|
title: title,
|
||||||
theme: opts.theme,
|
theme: opts.theme,
|
||||||
highlightTheme: opts.highlightTheme,
|
highlightTheme: opts.highlightTheme,
|
||||||
|
|
|
@ -11,8 +11,8 @@
|
||||||
<meta name="description" content="Realtime collaborative markdown notes on all platforms.">
|
<meta name="description" content="Realtime collaborative markdown notes on all platforms.">
|
||||||
<meta name="author" content="jackycute">
|
<meta name="author" content="jackycute">
|
||||||
<title>HackMD - Collaborative notes</title>
|
<title>HackMD - Collaborative notes</title>
|
||||||
<link rel="icon" type="image/png" href="/favicon.png">
|
<link rel="icon" type="image/png" href="<%- url %>/favicon.png">
|
||||||
<link rel="apple-touch-icon" href="/apple-touch-icon.png">
|
<link rel="apple-touch-icon" href="<%- url %>/apple-touch-icon.png">
|
||||||
|
|
||||||
<!-- Bootstrap core CSS -->
|
<!-- Bootstrap core CSS -->
|
||||||
<% if(useCDN) { %>
|
<% 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="//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">
|
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/bootstrap-social/4.9.0/bootstrap-social.min.css">
|
||||||
<% } else { %>
|
<% } else { %>
|
||||||
<link rel="stylesheet" href="/vendor/bootstrap/dist/css/bootstrap.min.css">
|
<link rel="stylesheet" href="<%- url %>/vendor/bootstrap/dist/css/bootstrap.min.css">
|
||||||
<link rel="stylesheet" href="/vendor/font-awesome/css/font-awesome.min.css">
|
<link rel="stylesheet" href="<%- url %>/vendor/font-awesome/css/font-awesome.min.css">
|
||||||
<link rel="stylesheet" href="/css/bootstrap-social.css">
|
<link rel="stylesheet" href="<%- url %>/css/bootstrap-social.css">
|
||||||
<% } %>
|
<% } %>
|
||||||
<link rel="stylesheet" href="/vendor/select2/select2.css">
|
<link rel="stylesheet" href="<%- url %>/vendor/select2/select2.css">
|
||||||
<link rel="stylesheet" href="/vendor/select2/select2-bootstrap.css">
|
<link rel="stylesheet" href="<%- url %>/vendor/select2/select2-bootstrap.css">
|
||||||
<!-- Custom styles for this template -->
|
<!-- Custom styles for this template -->
|
||||||
<link rel="stylesheet" href="/css/cover.css">
|
<link rel="stylesheet" href="<%- url %>/css/cover.css">
|
||||||
<link rel="stylesheet" href="/css/site.css">
|
<link rel="stylesheet" href="<%- url %>/css/site.css">
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<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>
|
<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>
|
<div class="ui-or" style="display:none;">Or</div>
|
||||||
<p class="lead">
|
<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>
|
</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!
|
<br> Share note via the links <i class="fa fa-link"></i> directly!
|
||||||
</div>
|
</div>
|
||||||
<br>
|
<br>
|
||||||
|
@ -78,11 +78,11 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="ui-signout" style="display:none;">
|
<div class="ui-signout" style="display:none;">
|
||||||
<h4 class="ui-welcome">Welcome! <span class="ui-name"></span></h4>
|
<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>
|
<a href="#" class="btn btn-danger ui-logout">Sign Out</a>
|
||||||
<br>
|
<br>
|
||||||
<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!
|
<br> Share note via the links <i class="fa fa-link"></i> directly!
|
||||||
</div>
|
</div>
|
||||||
<hr>
|
<hr>
|
||||||
|
@ -169,16 +169,16 @@
|
||||||
<h4 class="modal-title" id="mySmallModalLabel">Choose method</h4>
|
<h4 class="modal-title" id="mySmallModalLabel">Choose method</h4>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<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
|
<i class="fa fa-facebook"></i> Sign in via Facebook
|
||||||
</a>
|
</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
|
<i class="fa fa-twitter"></i> Sign in via Twitter
|
||||||
</a>
|
</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
|
<i class="fa fa-github"></i> Sign in via GitHub
|
||||||
</a>
|
</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
|
<i class="fa fa-dropbox"></i> Sign in via Dropbox
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</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/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>
|
<script src="//cdnjs.cloudflare.com/ajax/libs/js-url/2.0.2/url.min.js" defer></script>
|
||||||
<% } else { %>
|
<% } else { %>
|
||||||
<script src="/vendor/jquery/dist/jquery.min.js" defer></script>
|
<script src="<%- url %>/vendor/jquery/dist/jquery.min.js" defer></script>
|
||||||
<script src="/vendor/bootstrap/dist/js/bootstrap.min.js" defer></script>
|
<script src="<%- url %>/vendor/bootstrap/dist/js/bootstrap.min.js" defer></script>
|
||||||
<script src="/vendor/gsap/src/minified/TweenMax.min.js" defer></script>
|
<script src="<%- url %>/vendor/gsap/src/minified/TweenMax.min.js" defer></script>
|
||||||
<script src="/vendor/gsap/src/minified/jquery.gsap.min.js" defer></script>
|
<script src="<%- url %>/vendor/gsap/src/minified/jquery.gsap.min.js" defer></script>
|
||||||
<script src="/vendor/select2/select2.min.js" defer></script>
|
<script src="<%- url %>/vendor/select2/select2.min.js" defer></script>
|
||||||
<script src="/vendor/moment/min/moment-with-locales.min.js" defer></script>
|
<script src="<%- url %>/vendor/moment/min/moment-with-locales.min.js" defer></script>
|
||||||
<script src="/vendor/handlebars/handlebars.min.js" defer></script>
|
<script src="<%- url %>/vendor/handlebars/handlebars.min.js" defer></script>
|
||||||
<script src="/vendor/js-url/url.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="<%- url %>/vendor/js.cookie.js" defer></script>
|
||||||
<script src="/vendor/list.min.js" defer></script>
|
<script src="<%- url %>/vendor/list.min.js" defer></script>
|
||||||
<script src="/vendor/FileSaver.min.js" defer></script>
|
<script src="<%- url %>/vendor/FileSaver.min.js" defer></script>
|
||||||
<script src="/vendor/store.min.js" defer></script>
|
<script src="<%- url %>/vendor/store.min.js" defer></script>
|
||||||
<script src="/vendor/lz-string/libs/lz-string.min.js" defer></script>
|
<script src="<%- url %>/vendor/lz-string/libs/lz-string.min.js" defer></script>
|
||||||
<script src="/js/common.js" defer></script>
|
<script src="<%- url %>/js/common.js" defer></script>
|
||||||
<script src="/js/history.js" defer></script>
|
<script src="<%- url %>/js/history.js" defer></script>
|
||||||
<script src="/js/cover.js" defer></script>
|
<script src="<%- url %>/js/cover.js" defer></script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
|
@ -1,5 +1,12 @@
|
||||||
//common
|
//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 checkAuth = false;
|
||||||
var profile = null;
|
var profile = null;
|
||||||
var lastLoginState = getLoginState();
|
var lastLoginState = getLoginState();
|
||||||
|
@ -53,7 +60,7 @@ function checkIfAuth(yesCallback, noCallback) {
|
||||||
if (checkLoginStateChanged())
|
if (checkLoginStateChanged())
|
||||||
checkAuth = false;
|
checkAuth = false;
|
||||||
if (!checkAuth || typeof cookieLoginState == 'undefined') {
|
if (!checkAuth || typeof cookieLoginState == 'undefined') {
|
||||||
$.get('/me')
|
$.get(serverurl + '/me')
|
||||||
.done(function (data) {
|
.done(function (data) {
|
||||||
if (data && data.status == 'ok') {
|
if (data && data.status == 'ok') {
|
||||||
profile = data;
|
profile = data;
|
||||||
|
|
|
@ -120,7 +120,7 @@ function parseHistoryCallback(list, notehistory) {
|
||||||
pin.removeClass('active');
|
pin.removeClass('active');
|
||||||
}
|
}
|
||||||
//parse link to element a
|
//parse link to element a
|
||||||
a.attr('href', '/' + values.id);
|
a.attr('href', serverurl + '/' + values.id);
|
||||||
//parse tags
|
//parse tags
|
||||||
if (values.tags) {
|
if (values.tags) {
|
||||||
var tags = values.tags;
|
var tags = values.tags;
|
||||||
|
|
|
@ -402,10 +402,11 @@ function exportToHTML(view) {
|
||||||
var tocAffix = $('#toc-affix').clone();
|
var tocAffix = $('#toc-affix').clone();
|
||||||
tocAffix.find('*').removeClass('active');
|
tocAffix.find('*').removeClass('active');
|
||||||
//generate html via template
|
//generate html via template
|
||||||
$.get('/css/html.min.css', function (css) {
|
$.get(serverurl + '/css/html.min.css', function (css) {
|
||||||
$.get('/views/html.hbs', function (data) {
|
$.get(serverurl + '/views/html.hbs', function (data) {
|
||||||
var template = Handlebars.compile(data);
|
var template = Handlebars.compile(data);
|
||||||
var context = {
|
var context = {
|
||||||
|
url: serverurl,
|
||||||
title: title,
|
title: title,
|
||||||
css: css,
|
css: css,
|
||||||
html: src[0].outerHTML,
|
html: src[0].outerHTML,
|
||||||
|
@ -657,7 +658,7 @@ emojify.setConfig({
|
||||||
elements: ['script', 'textarea', 'a', 'pre', 'code', 'svg'],
|
elements: ['script', 'textarea', 'a', 'pre', 'code', 'svg'],
|
||||||
classes: ['no-emojify']
|
classes: ['no-emojify']
|
||||||
},
|
},
|
||||||
img_dir: '/vendor/emojify/images',
|
img_dir: serverurl + '/vendor/emojify/images',
|
||||||
ignore_emoticons: true
|
ignore_emoticons: true
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ migrateHistoryFromTemp();
|
||||||
|
|
||||||
function migrateHistoryFromTemp() {
|
function migrateHistoryFromTemp() {
|
||||||
if (url('#tempid')) {
|
if (url('#tempid')) {
|
||||||
$.get('/temp', {
|
$.get(serverurl + '/temp', {
|
||||||
tempid: url('#tempid')
|
tempid: url('#tempid')
|
||||||
})
|
})
|
||||||
.done(function (data) {
|
.done(function (data) {
|
||||||
|
@ -57,7 +57,7 @@ function saveHistoryToCookie(notehistory) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function saveHistoryToServer(notehistory) {
|
function saveHistoryToServer(notehistory) {
|
||||||
$.post('/history', {
|
$.post(serverurl + '/history', {
|
||||||
history: JSON.stringify(notehistory)
|
history: JSON.stringify(notehistory)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -70,7 +70,7 @@ function saveCookieHistoryToStorage(callback) {
|
||||||
function saveStorageHistoryToServer(callback) {
|
function saveStorageHistoryToServer(callback) {
|
||||||
var data = store.get('notehistory');
|
var data = store.get('notehistory');
|
||||||
if (data) {
|
if (data) {
|
||||||
$.post('/history', {
|
$.post(serverurl + '/history', {
|
||||||
history: data
|
history: data
|
||||||
})
|
})
|
||||||
.done(function (data) {
|
.done(function (data) {
|
||||||
|
@ -80,7 +80,7 @@ function saveStorageHistoryToServer(callback) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function saveCookieHistoryToServer(callback) {
|
function saveCookieHistoryToServer(callback) {
|
||||||
$.post('/history', {
|
$.post(serverurl + '/history', {
|
||||||
history: Cookies.get('notehistory')
|
history: Cookies.get('notehistory')
|
||||||
})
|
})
|
||||||
.done(function (data) {
|
.done(function (data) {
|
||||||
|
@ -112,6 +112,8 @@ function clearDuplicatedHistory(notehistory) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function addHistory(id, text, time, tags, pinned, notehistory) {
|
function addHistory(id, text, time, tags, pinned, notehistory) {
|
||||||
|
// only add when note id exists
|
||||||
|
if (id) {
|
||||||
notehistory.push({
|
notehistory.push({
|
||||||
id: id,
|
id: id,
|
||||||
text: text,
|
text: text,
|
||||||
|
@ -119,6 +121,7 @@ function addHistory(id, text, time, tags, pinned, notehistory) {
|
||||||
tags: tags,
|
tags: tags,
|
||||||
pinned: pinned
|
pinned: pinned
|
||||||
});
|
});
|
||||||
|
}
|
||||||
return notehistory;
|
return notehistory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,7 +148,7 @@ function writeHistory(view) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function writeHistoryToServer(view) {
|
function writeHistoryToServer(view) {
|
||||||
$.get('/history')
|
$.get(serverurl + '/history')
|
||||||
.done(function (data) {
|
.done(function (data) {
|
||||||
try {
|
try {
|
||||||
if (data.history) {
|
if (data.history) {
|
||||||
|
@ -223,8 +226,9 @@ function renderHistory(view) {
|
||||||
tags.push(rawtags[i].innerHTML);
|
tags.push(rawtags[i].innerHTML);
|
||||||
}
|
}
|
||||||
//console.debug(tags);
|
//console.debug(tags);
|
||||||
|
var id = urlpath ? location.pathname.slice(urlpath.length + 1, location.pathname.length).split('/')[1] : location.pathname.split('/')[1];
|
||||||
return {
|
return {
|
||||||
id: location.pathname.split('/')[1],
|
id: id,
|
||||||
text: title,
|
text: title,
|
||||||
time: moment().format('MMMM Do YYYY, h:mm:ss a'),
|
time: moment().format('MMMM Do YYYY, h:mm:ss a'),
|
||||||
tags: tags
|
tags: tags
|
||||||
|
@ -260,7 +264,7 @@ function getHistory(callback) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function getServerHistory(callback) {
|
function getServerHistory(callback) {
|
||||||
$.get('/history')
|
$.get(serverurl + '/history')
|
||||||
.done(function (data) {
|
.done(function (data) {
|
||||||
if (data.history) {
|
if (data.history) {
|
||||||
callback(data.history);
|
callback(data.history);
|
||||||
|
@ -301,7 +305,7 @@ function parseHistory(list, callback) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseServerToHistory(list, callback) {
|
function parseServerToHistory(list, callback) {
|
||||||
$.get('/history')
|
$.get(serverurl + '/history')
|
||||||
.done(function (data) {
|
.done(function (data) {
|
||||||
if (data.history) {
|
if (data.history) {
|
||||||
parseToHistory(list, data.history, callback);
|
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].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].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');
|
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]);
|
list.add(notehistory[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -288,7 +288,7 @@ var statusLength = null;
|
||||||
var statusKeymap = null;
|
var statusKeymap = null;
|
||||||
var statusIndent = null;
|
var statusIndent = null;
|
||||||
|
|
||||||
$.get('/views/statusbar.html', function (template) {
|
$.get(serverurl + '/views/statusbar.html', function (template) {
|
||||||
statusBarTemplate = template;
|
statusBarTemplate = template;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -994,9 +994,8 @@ function closestIndex(arr, closestTo) {
|
||||||
}
|
}
|
||||||
|
|
||||||
//button actions
|
//button actions
|
||||||
var url = window.location.protocol + '//' + window.location.host + window.location.pathname;
|
|
||||||
//share
|
//share
|
||||||
ui.toolbar.publish.attr("href", url + "/publish");
|
ui.toolbar.publish.attr("href", noteurl + "/publish");
|
||||||
//download
|
//download
|
||||||
//markdown
|
//markdown
|
||||||
ui.toolbar.download.markdown.click(function (e) {
|
ui.toolbar.download.markdown.click(function (e) {
|
||||||
|
@ -1021,7 +1020,7 @@ ui.toolbar.export.dropbox.click(function () {
|
||||||
var options = {
|
var options = {
|
||||||
files: [
|
files: [
|
||||||
{
|
{
|
||||||
'url': url + "/download",
|
'url': noteurl + "/download",
|
||||||
'filename': filename
|
'filename': filename
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
@ -1032,7 +1031,7 @@ ui.toolbar.export.dropbox.click(function () {
|
||||||
Dropbox.save(options);
|
Dropbox.save(options);
|
||||||
});
|
});
|
||||||
//export to gist
|
//export to gist
|
||||||
ui.toolbar.export.gist.attr("href", url + "/gist");
|
ui.toolbar.export.gist.attr("href", noteurl + "/gist");
|
||||||
//import from dropbox
|
//import from dropbox
|
||||||
ui.toolbar.import.dropbox.click(function () {
|
ui.toolbar.import.dropbox.click(function () {
|
||||||
var options = {
|
var options = {
|
||||||
|
@ -1064,9 +1063,9 @@ ui.toc.dropdown.click(function (e) {
|
||||||
});
|
});
|
||||||
//beta
|
//beta
|
||||||
//pdf
|
//pdf
|
||||||
ui.toolbar.beta.pdf.attr("download", "").attr("href", url + "/pdf");
|
ui.toolbar.beta.pdf.attr("download", "").attr("href", noteurl + "/pdf");
|
||||||
//slide
|
//slide
|
||||||
ui.toolbar.beta.slide.attr("href", url + "/slide");
|
ui.toolbar.beta.slide.attr("href", noteurl + "/slide");
|
||||||
|
|
||||||
function scrollToTop() {
|
function scrollToTop() {
|
||||||
if (currentMode == modeType.both) {
|
if (currentMode == modeType.both) {
|
||||||
|
@ -1325,6 +1324,7 @@ function havePermission() {
|
||||||
|
|
||||||
//socket.io actions
|
//socket.io actions
|
||||||
var socket = io.connect({
|
var socket = io.connect({
|
||||||
|
path: urlpath ? '/' + urlpath + '/socket.io/' : '',
|
||||||
timeout: 10000 //10 secs to timeout
|
timeout: 10000 //10 secs to timeout
|
||||||
});
|
});
|
||||||
//overwrite original event for checking login state
|
//overwrite original event for checking login state
|
||||||
|
@ -2450,7 +2450,7 @@ $(editor.getInputField())
|
||||||
checkCursorMenu();
|
checkCursorMenu();
|
||||||
},
|
},
|
||||||
template: function (value) {
|
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) {
|
replace: function (value) {
|
||||||
return ':' + value + ':';
|
return ':' + value + ':';
|
||||||
|
|
11
public/vendor/raphael-min.js
vendored
11
public/vendor/raphael-min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -83,16 +83,16 @@
|
||||||
<h4 class="modal-title" id="mySmallModalLabel">Please sign in to edit</h4>
|
<h4 class="modal-title" id="mySmallModalLabel">Please sign in to edit</h4>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<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
|
<i class="fa fa-facebook"></i> Sign in via Facebook
|
||||||
</a>
|
</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
|
<i class="fa fa-twitter"></i> Sign in via Twitter
|
||||||
</a>
|
</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
|
<i class="fa fa-github"></i> Sign in via GitHub
|
||||||
</a>
|
</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
|
<i class="fa fa-dropbox"></i> Sign in via Dropbox
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<%- include head %>
|
<%- include head %>
|
||||||
<link rel="stylesheet" href="/css/center.css">
|
<link rel="stylesheet" href="<%- url %>/css/center.css">
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
|
@ -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/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>
|
<script src="//cdnjs.cloudflare.com/ajax/libs/js-yaml/3.4.6/js-yaml.min.js" defer></script>
|
||||||
<% } else { %>
|
<% } else { %>
|
||||||
<script src="/vendor/spin.js/spin.min.js" defer></script>
|
<script src="<%- url %>/vendor/spin.js/spin.min.js" defer></script>
|
||||||
<script src="/vendor/jquery/dist/jquery.min.js"></script>
|
<script src="<%- url %>/vendor/jquery/dist/jquery.min.js"></script>
|
||||||
<script src="/vendor/jquery-mousewheel/jquery.mousewheel.min.js" defer></script>
|
<script src="<%- url %>/vendor/jquery-mousewheel/jquery.mousewheel.min.js" defer></script>
|
||||||
<script src="/vendor/bootstrap/dist/js/bootstrap.min.js" defer></script>
|
<script src="<%- url %>/vendor/bootstrap/dist/js/bootstrap.min.js" defer></script>
|
||||||
<script src="/vendor/gsap/src/minified/TweenMax.min.js" defer></script>
|
<script src="<%- url %>/vendor/gsap/src/minified/TweenMax.min.js" defer></script>
|
||||||
<script src="/vendor/gsap/src/minified/jquery.gsap.min.js" defer></script>
|
<script src="<%- url %>/vendor/gsap/src/minified/jquery.gsap.min.js" defer></script>
|
||||||
<script src="/vendor/socket.io-client/socket.io.js" defer></script>
|
<script src="<%- url %>/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/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-->
|
<!--codemirror-->
|
||||||
<script src="/vendor/codemirror/codemirror.min.js" defer></script>
|
<script src="<%- url %>/vendor/codemirror/codemirror.min.js" defer></script>
|
||||||
<script src="/vendor/inlineAttachment/inline-attachment.js" defer></script>
|
<script src="<%- url %>/vendor/inlineAttachment/inline-attachment.js" defer></script>
|
||||||
<script src="/vendor/inlineAttachment/codemirror.inline-attachment.js" defer></script>
|
<script src="<%- url %>/vendor/inlineAttachment/codemirror.inline-attachment.js" defer></script>
|
||||||
<!--ot-->
|
<!--ot-->
|
||||||
<script src="/vendor/ot/ot.min.js" defer></script>
|
<script src="<%- url %>/vendor/ot/ot.min.js" defer></script>
|
||||||
<!--others-->
|
<!--others-->
|
||||||
<script src="/vendor/remarkable.min.js" defer></script>
|
<script src="<%- url %>/vendor/remarkable.js" defer></script>
|
||||||
<script src="/vendor/remarkable-regex.js" defer></script>
|
<script src="<%- url %>/vendor/remarkable-regex.js" defer></script>
|
||||||
<script src="/vendor/gist-embed.js" defer></script>
|
<script src="<%- url %>/vendor/gist-embed.js" defer></script>
|
||||||
<script src="/vendor/lz-string/libs/lz-string.min.js" defer></script>
|
<script src="<%- url %>/vendor/lz-string/libs/lz-string.min.js" defer></script>
|
||||||
<script src="/vendor/xss/dist/xss.min.js" defer></script>
|
<script src="<%- url %>/vendor/xss/dist/xss.min.js" defer></script>
|
||||||
<script src="/vendor/string.min.js" defer></script>
|
<script src="<%- url %>/vendor/string.min.js" defer></script>
|
||||||
<script src="/vendor/highlight-js/highlight.min.js" defer></script>
|
<script src="<%- url %>/vendor/highlight-js/highlight.min.js" defer></script>
|
||||||
<script src="/vendor/js.cookie.js" defer></script>
|
<script src="<%- url %>/vendor/js.cookie.js" defer></script>
|
||||||
<script src="/vendor/moment/min/moment-with-locales.js" defer></script>
|
<script src="<%- url %>/vendor/moment/min/moment-with-locales.js" defer></script>
|
||||||
<script src="/vendor/handlebars/handlebars.min.js" defer></script>
|
<script src="<%- url %>/vendor/handlebars/handlebars.min.js" defer></script>
|
||||||
<script src="/vendor/emojify/js/emojify.min.js" defer></script>
|
<script src="<%- url %>/vendor/emojify/js/emojify.min.js" defer></script>
|
||||||
<script src="/vendor/to-markdown/dist/to-markdown.js" defer></script>
|
<script src="<%- url %>/vendor/to-markdown/dist/to-markdown.js" defer></script>
|
||||||
<script src="/vendor/raphael-min.js" defer></script>
|
<script src="<%- url %>/vendor/raphael/raphael-min.js" defer></script>
|
||||||
<script src="/vendor/lodash.min.js" defer></script>
|
<script src="<%- url %>/vendor/lodash.min.js" defer></script>
|
||||||
<script src="/vendor/sequence-diagrams/sequence-diagram-min.js" defer></script>
|
<script src="<%- url %>/vendor/sequence-diagrams/sequence-diagram-min.js" defer></script>
|
||||||
<script src="/vendor/flowchart/release/flowchart.min.js" defer></script>
|
<script src="<%- url %>/vendor/flowchart/release/flowchart.min.js" defer></script>
|
||||||
<script src="/vendor/viz.js/viz.js" defer></script>
|
<script src="<%- url %>/vendor/viz.js/viz.js" defer></script>
|
||||||
<script src="/vendor/FileSaver.min.js" defer></script>
|
<script src="<%- url %>/vendor/FileSaver.min.js" defer></script>
|
||||||
<script src="/vendor/store.min.js" defer></script>
|
<script src="<%- url %>/vendor/store.min.js" defer></script>
|
||||||
<script src="/vendor/js-url/url.min.js" defer></script>
|
<script src="<%- url %>/vendor/js-url/url.min.js" defer></script>
|
||||||
<script src="/vendor/jquery-textcomplete/jquery.textcomplete.js" defer></script>
|
<script src="<%- url %>/vendor/jquery-textcomplete/jquery.textcomplete.js" defer></script>
|
||||||
<script src="/vendor/idle.js" defer></script>
|
<script src="<%- url %>/vendor/idle.js" defer></script>
|
||||||
<script src="/vendor/visibility-1.2.1.min.js" defer></script>
|
<script src="<%- url %>/vendor/visibility-1.2.1.min.js" defer></script>
|
||||||
<script src="/vendor/list.min.js" defer></script>
|
<script src="<%- url %>/vendor/list.min.js" defer></script>
|
||||||
<script src="/vendor/md5.min.js" defer></script>
|
<script src="<%- url %>/vendor/md5.min.js" defer></script>
|
||||||
<script src="/vendor/md-toc.js" defer></script>
|
<script src="<%- url %>/vendor/md-toc.js" defer></script>
|
||||||
<script src="/vendor/showup/showup.js" defer></script>
|
<script src="<%- url %>/vendor/showup/showup.js" defer></script>
|
||||||
<script src="/vendor/randomColor.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/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">
|
<script type="text/x-mathjax-config">
|
||||||
MathJax.Hub.Config({ messageStyle: "none", skipStartupTypeset: true ,tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']], processEscapes: true }});
|
MathJax.Hub.Config({ messageStyle: "none", skipStartupTypeset: true ,tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']], processEscapes: true }});
|
||||||
</script>
|
</script>
|
||||||
<script type="text/javascript" src="//cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" defer></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="<%- url %>/js/common.js" defer></script>
|
||||||
<script src="/js/extra.js" defer></script>
|
<script src="<%- url %>/js/extra.js" defer></script>
|
||||||
<script src="/js/render.js" defer></script>
|
<script src="<%- url %>/js/render.js" defer></script>
|
||||||
<script src="/js/history.js" defer></script>
|
<script src="<%- url %>/js/history.js" defer></script>
|
||||||
<script src="/js/index.js" defer></script>
|
<script src="<%- url %>/js/index.js" defer></script>
|
||||||
<script src="/js/syncscroll.js" defer></script>
|
<script src="<%- url %>/js/syncscroll.js" defer></script>
|
|
@ -8,34 +8,34 @@
|
||||||
<meta name="robots" content="<%- robots %>">
|
<meta name="robots" content="<%- robots %>">
|
||||||
<% } %>
|
<% } %>
|
||||||
<title><%- title %></title>
|
<title><%- title %></title>
|
||||||
<link rel="icon" type="image/png" href="/favicon.png">
|
<link rel="icon" type="image/png" href="<%- url %>/favicon.png">
|
||||||
<link rel="apple-touch-icon" href="/apple-touch-icon.png">
|
<link rel="apple-touch-icon" href="<%- url %>/apple-touch-icon.png">
|
||||||
<% if(useCDN) { %>
|
<% if(useCDN) { %>
|
||||||
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
|
<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="//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">
|
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/bootstrap-social/4.9.0/bootstrap-social.min.css">
|
||||||
<% } else { %>
|
<% } else { %>
|
||||||
<link rel="stylesheet" href="/vendor/bootstrap/dist/css/bootstrap.min.css">
|
<link rel="stylesheet" href="<%- url %>/vendor/bootstrap/dist/css/bootstrap.min.css">
|
||||||
<link rel="stylesheet" href="/vendor/font-awesome/css/font-awesome.min.css">
|
<link rel="stylesheet" href="<%- url %>/vendor/font-awesome/css/font-awesome.min.css">
|
||||||
<link rel="stylesheet" href="/css/bootstrap-social.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="<%- url %>/vendor/jquery-ui/jquery-ui.min.css">
|
||||||
<link rel="stylesheet" href="/vendor/codemirror/lib/codemirror.css">
|
<link rel="stylesheet" href="<%- url %>/vendor/codemirror/lib/codemirror.css">
|
||||||
<link rel="stylesheet" href="/vendor/codemirror/addon/fold/foldgutter.css">
|
<link rel="stylesheet" href="<%- url %>/vendor/codemirror/addon/fold/foldgutter.css">
|
||||||
<link rel="stylesheet" href="/vendor/codemirror/addon/display/fullscreen.css">
|
<link rel="stylesheet" href="<%- url %>/vendor/codemirror/addon/display/fullscreen.css">
|
||||||
<link rel="stylesheet" href="/vendor/codemirror/addon/dialog/dialog.css">
|
<link rel="stylesheet" href="<%- url %>/vendor/codemirror/addon/dialog/dialog.css">
|
||||||
<link rel="stylesheet" href="/vendor/codemirror/addon/scroll/simplescrollbars.css">
|
<link rel="stylesheet" href="<%- url %>/vendor/codemirror/addon/scroll/simplescrollbars.css">
|
||||||
<link rel="stylesheet" href="/vendor/codemirror/addon/search/matchesonscrollbar.css">
|
<link rel="stylesheet" href="<%- url %>/vendor/codemirror/addon/search/matchesonscrollbar.css">
|
||||||
<link rel="stylesheet" href="/vendor/codemirror/theme/monokai.css">
|
<link rel="stylesheet" href="<%- url %>/vendor/codemirror/theme/monokai.css">
|
||||||
<link rel="stylesheet" href="/vendor/codemirror/theme/one-dark.css">
|
<link rel="stylesheet" href="<%- url %>/vendor/codemirror/theme/one-dark.css">
|
||||||
<link rel="stylesheet" href="/css/github-extract.css">
|
<link rel="stylesheet" href="<%- url %>/css/github-extract.css">
|
||||||
<link rel="stylesheet" href="/vendor/highlight-js/github-gist.min.css">
|
<link rel="stylesheet" href="<%- url %>/vendor/highlight-js/github-gist.min.css">
|
||||||
<link rel="stylesheet" href="/vendor/emojify/css/emojify.min.css">
|
<link rel="stylesheet" href="<%- url %>/vendor/emojify/css/emojify.min.css">
|
||||||
<link rel="stylesheet" href="/vendor/showup/showup.css">
|
<link rel="stylesheet" href="<%- url %>/vendor/showup/showup.css">
|
||||||
<link rel="stylesheet" href="/css/markdown.css">
|
<link rel="stylesheet" href="<%- url %>/css/markdown.css">
|
||||||
<link rel="stylesheet" href="/css/index.css">
|
<link rel="stylesheet" href="<%- url %>/css/index.css">
|
||||||
<link rel="stylesheet" href="/css/extra.css">
|
<link rel="stylesheet" href="<%- url %>/css/extra.css">
|
||||||
<link rel="stylesheet" href="/css/site.css">
|
<link rel="stylesheet" href="<%- url %>/css/site.css">
|
||||||
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
|
<!-- 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:// -->
|
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
|
||||||
<!--[if lt IE 9]>
|
<!--[if lt IE 9]>
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
<ul class="dropdown-menu list" role="menu" aria-labelledby="menu">
|
<ul class="dropdown-menu list" role="menu" aria-labelledby="menu">
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</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">
|
<div class="nav-mobile pull-right visible-xs">
|
||||||
<span class="btn btn-link btn-file ui-upload-image" title="Upload Image" style="display:none;">
|
<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>
|
<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>
|
<i class="fa fa-caret-down"></i>
|
||||||
</a>
|
</a>
|
||||||
<ul class="dropdown-menu list" role="menu" aria-labelledby="menu">
|
<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>
|
||||||
<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 role="presentation"><a role="menuitem" class="ui-publish" tabindex="-1" href="#" target="_blank"><i class="fa fa-print fa-fw"></i> Publish</a>
|
||||||
</li>
|
</li>
|
||||||
|
@ -90,7 +90,7 @@
|
||||||
</ul>
|
</ul>
|
||||||
<ul class="nav navbar-nav navbar-right" style="padding:0;">
|
<ul class="nav navbar-nav navbar-right" style="padding:0;">
|
||||||
<li>
|
<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
|
<i class="fa fa-plus"></i> New
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
|
@ -13,8 +13,8 @@
|
||||||
<title>
|
<title>
|
||||||
{{title}}
|
{{title}}
|
||||||
</title>
|
</title>
|
||||||
<link rel="icon" type="image/png" href="https://hackmd.io/favicon.png">
|
<link rel="icon" type="image/png" href="{{{url}}}/favicon.png">
|
||||||
<link rel="apple-touch-icon" href="https://hackmd.io/apple-touch-icon.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/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">
|
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
|
||||||
|
|
|
@ -82,9 +82,10 @@
|
||||||
<script src="<%- url %>/vendor/gist-embed.js" defer></script>
|
<script src="<%- url %>/vendor/gist-embed.js" defer></script>
|
||||||
<script src="<%- url %>/vendor/string.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/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/moment/min/moment-with-locales.js" defer></script>
|
||||||
<script src="<%- url %>/vendor/emojify/js/emojify.min.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/lodash.min.js" defer></script>
|
||||||
<script src="<%- url %>/vendor/sequence-diagrams/sequence-diagram-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/flowchart/release/flowchart.min.js" defer></script>
|
||||||
|
@ -94,6 +95,7 @@
|
||||||
MathJax.Hub.Config({ messageStyle: "none", skipStartupTypeset: true ,tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']], processEscapes: true }});
|
MathJax.Hub.Config({ messageStyle: "none", skipStartupTypeset: true ,tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']], processEscapes: true }});
|
||||||
</script>
|
</script>
|
||||||
<script type="text/javascript" src="//cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" defer></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/extra.js" defer></script>
|
||||||
<script src="<%- url %>/js/render.js" defer></script>
|
<script src="<%- url %>/js/render.js" defer></script>
|
||||||
<script src="<%- url %>/js/pretty.js" defer></script>
|
<script src="<%- url %>/js/pretty.js" defer></script>
|
|
@ -3,7 +3,7 @@
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title>Directory Listing</title>
|
<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">
|
<style type="text/css">
|
||||||
body {
|
body {
|
||||||
margin: 1em;
|
margin: 1em;
|
||||||
|
|
|
@ -6,19 +6,19 @@
|
||||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||||
<meta name="mobile-web-app-capable" content="yes">
|
<meta name="mobile-web-app-capable" content="yes">
|
||||||
<title>{{title}}</title>
|
<title>{{title}}</title>
|
||||||
<link rel="icon" type="image/png" href="https://hackmd.io/favicon.png">
|
<link rel="icon" type="image/png" href="{{{url}}}/favicon.png">
|
||||||
<link rel="apple-touch-icon" href="https://hackmd.io/apple-touch-icon.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="{{{url}}}/vendor/reveal.js/css/reveal.css">
|
||||||
<link rel="stylesheet" href="/vendor/reveal.js/{{{theme}}}" id="theme">
|
<link rel="stylesheet" href="{{{url}}}/vendor/reveal.js/{{{theme}}}" id="theme">
|
||||||
<!-- For syntax highlighting -->
|
<!-- For syntax highlighting -->
|
||||||
<link rel="stylesheet" href="/vendor/reveal.js/lib/css/{{{highlightTheme}}}.css">
|
<link rel="stylesheet" href="{{{url}}}/vendor/reveal.js/lib/css/{{{highlightTheme}}}.css">
|
||||||
<link rel="stylesheet" href="/css/site.css">
|
<link rel="stylesheet" href="{{{url}}}/css/site.css">
|
||||||
<link rel="stylesheet" href="/css/slide.css">
|
<link rel="stylesheet" href="{{{url}}}/css/slide.css">
|
||||||
|
|
||||||
<!-- If the query includes 'print-pdf', use the PDF print sheet -->
|
<!-- If the query includes 'print-pdf', use the PDF print sheet -->
|
||||||
<script>
|
<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>
|
||||||
<script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
|
<script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
|
||||||
</head>
|
</head>
|
||||||
|
@ -28,11 +28,11 @@
|
||||||
<div class="slides">{{{slides}}}</div>
|
<div class="slides">{{{slides}}}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="/vendor/reveal.js/lib/js/head.min.js"></script>
|
<script src="{{{url}}}/vendor/reveal.js/lib/js/head.min.js"></script>
|
||||||
<script src="/vendor/reveal.js/js/reveal.js"></script>
|
<script src="{{{url}}}/vendor/reveal.js/js/reveal.js"></script>
|
||||||
<script src="/vendor/string.min.js"></script>
|
<script src="{{{url}}}/vendor/string.min.js"></script>
|
||||||
<script src="/vendor/xss/dist/xss.min.js"></script>
|
<script src="{{{url}}}/vendor/xss/dist/xss.min.js"></script>
|
||||||
<script src="/js/render.js"></script>
|
<script src="{{{url}}}/js/render.js"></script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
var body = $(".slides").html();
|
var body = $(".slides").html();
|
||||||
|
@ -53,12 +53,12 @@
|
||||||
|
|
||||||
// Optional libraries used to extend on reveal.js
|
// Optional libraries used to extend on reveal.js
|
||||||
var deps = [
|
var deps = [
|
||||||
{ src: '/vendor/reveal.js/lib/js/classList.js', condition: function() { return !document.body.classList; } },
|
{ src: '{{{url}}}/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: '{{{url}}}/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: '{{{url}}}/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: '{{{url}}}/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: '{{{url}}}/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/plugin/math/math.js', async: true }
|
||||||
];
|
];
|
||||||
|
|
||||||
// default options to init reveal.js
|
// default options to init reveal.js
|
||||||
|
|
Loading…
Reference in a new issue