Updated slide mode
This commit is contained in:
parent
54b33f181f
commit
031c96c72d
6 changed files with 42 additions and 22 deletions
4
app.js
4
app.js
|
@ -358,10 +358,8 @@ app.get("/features", response.showFeatures);
|
|||
app.get("/s/:shortid", response.showPublishNote);
|
||||
//publish note actions
|
||||
app.get("/s/:shortid/:action", response.publishNoteActions);
|
||||
|
||||
//add p
|
||||
//get publish slide
|
||||
app.get("/p/:shortid", response.showPublishSlide);
|
||||
|
||||
//get note by id
|
||||
app.get("/:noteId", response.showNote);
|
||||
//note actions
|
||||
|
|
|
@ -24,8 +24,8 @@ var Mustache = require('mustache');
|
|||
var opts = {
|
||||
userBasePath: process.cwd(),
|
||||
revealBasePath: path.resolve(require.resolve('reveal.js'), '..', '..'),
|
||||
template: fs.readFileSync(path.join('.', '/public/views/templates', 'reveal.html')).toString(),
|
||||
templateListing: fs.readFileSync(path.join('.', '/public/views/templates', 'listing.html')).toString(),
|
||||
template: fs.readFileSync(path.join('.', '/public/views/slide', 'reveal.hbs')).toString(),
|
||||
templateListing: fs.readFileSync(path.join('.', '/public/views/slide', 'listing.hbs')).toString(),
|
||||
theme: 'css/theme/black.css',
|
||||
highlightTheme: 'zenburn',
|
||||
separator: '^(\r\n?|\n)---(\r\n?|\n)$',
|
||||
|
@ -404,7 +404,6 @@ function publishNoteActions(req, res, next) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
function showPublishSlide(req, res, next) {
|
||||
var shortid = req.params.shortid;
|
||||
if (shortId.isValid(shortid)) {
|
||||
|
@ -425,8 +424,12 @@ function showPublishSlide(req, res, next) {
|
|||
return;
|
||||
}
|
||||
var body = LZString.decompressFromBase64(data.rows[0].content);
|
||||
var title = data.rows[0].title;
|
||||
var decodedTitle = LZString.decompressFromBase64(title);
|
||||
if (decodedTitle) title = decodedTitle;
|
||||
title = Note.generateWebTitle(title);
|
||||
var text = S(body).escapeHTML().s;
|
||||
render(res, text);
|
||||
render(res, title, text);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -436,10 +439,11 @@ function showPublishSlide(req, res, next) {
|
|||
}
|
||||
|
||||
//reveal.js render
|
||||
var render = function (res, markdown) {
|
||||
var render = function (res, title, markdown) {
|
||||
var slides = md.slidify(markdown, opts);
|
||||
|
||||
res.end(Mustache.to_html(opts.template, {
|
||||
title: title,
|
||||
theme: opts.theme,
|
||||
highlightTheme: opts.highlightTheme,
|
||||
slides: slides,
|
||||
|
|
|
@ -283,7 +283,6 @@ var ui = {
|
|||
shortStatus: $(".ui-short-status"),
|
||||
status: $(".ui-status"),
|
||||
new: $(".ui-new"),
|
||||
slide: $(".ui-slide"),
|
||||
publish: $(".ui-publish"),
|
||||
download: {
|
||||
markdown: $(".ui-download-markdown"),
|
||||
|
@ -296,6 +295,10 @@ var ui = {
|
|||
dropbox: $(".ui-import-dropbox"),
|
||||
clipboard: $(".ui-import-clipboard")
|
||||
},
|
||||
beta: {
|
||||
pdf: $(".ui-beta-pdf"),
|
||||
slide: $(".ui-beta-slide")
|
||||
},
|
||||
mode: $(".ui-mode"),
|
||||
edit: $(".ui-edit"),
|
||||
view: $(".ui-view"),
|
||||
|
@ -793,7 +796,6 @@ function closestIndex(arr, closestTo) {
|
|||
var url = window.location.protocol + '//' + window.location.host + window.location.pathname;
|
||||
//share
|
||||
ui.toolbar.publish.attr("href", url + "/publish");
|
||||
ui.toolbar.slide.attr("href", url + "/slide");
|
||||
//download
|
||||
//markdown
|
||||
ui.toolbar.download.markdown.click(function () {
|
||||
|
@ -853,6 +855,11 @@ ui.toolbar.uploadImage.bind('change', function (e) {
|
|||
ui.toc.dropdown.click(function (e) {
|
||||
e.stopPropagation();
|
||||
});
|
||||
//beta
|
||||
//pdf
|
||||
ui.toolbar.beta.pdf.attr("download", "").attr("href", url + "/pdf");
|
||||
//slide
|
||||
ui.toolbar.beta.slide.attr("href", url + "/slide");
|
||||
|
||||
function scrollToTop() {
|
||||
if (currentMode == modeType.both) {
|
||||
|
|
|
@ -21,14 +21,18 @@
|
|||
<a data-target="#" data-toggle="dropdown" class="btn btn-link">
|
||||
<i class="fa fa-caret-down"></i>
|
||||
</a>
|
||||
<ul class="dropdown-menu" 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>
|
||||
<li role="presentation"><a role="menuitem" class="ui-slide" tabindex="-1" href="#" target="_blank"><i class="fa fa-television fa-fw"></i> Slides</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>
|
||||
<li class="divider"></li>
|
||||
<li class="dropdown-header">Beta</li>
|
||||
<li role="presentation"><a role="menuitem" class="ui-beta-pdf" tabindex="-1" href="#" target="_self"><i class="fa fa-file-pdf-o fa-fw"></i> Export PDF</a>
|
||||
</li>
|
||||
<li role="presentation"><a role="menuitem" class="ui-beta-slide" tabindex="-1" href="#" target="_blank"><i class="fa fa-tv fa-fw"></i> Slide Mode</a>
|
||||
</li>
|
||||
<li class="divider"></li>
|
||||
<li class="dropdown-header">Export</li>
|
||||
<li role="presentation"><a role="menuitem" class="ui-save-dropbox" tabindex="-1" href="#" target="_self"><i class="fa fa-dropbox fa-fw"></i> Dropbox</a>
|
||||
</li>
|
||||
|
@ -88,11 +92,6 @@
|
|||
<i class="fa fa-plus"></i> New
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#" target="_blank" class="ui-slide">
|
||||
<i class="fa fa-television"></i> Slide
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#" target="_blank" class="ui-publish">
|
||||
<i class="fa fa-print"></i> Publish
|
||||
|
@ -103,6 +102,12 @@
|
|||
Menu <i class="fa fa-caret-down"></i>
|
||||
</a>
|
||||
<ul class="dropdown-menu" role="menu" aria-labelledby="menu">
|
||||
<li class="dropdown-header">Beta</li>
|
||||
<li role="presentation"><a role="menuitem" class="ui-beta-pdf" tabindex="-1" href="#" target="_self"><i class="fa fa-file-pdf-o fa-fw"></i> Export PDF</a>
|
||||
</li>
|
||||
<li role="presentation"><a role="menuitem" class="ui-beta-slide" tabindex="-1" href="#" target="_blank"><i class="fa fa-tv fa-fw"></i> Slide Mode</a>
|
||||
</li>
|
||||
<li class="divider"></li>
|
||||
<li class="dropdown-header">Export</li>
|
||||
<li role="presentation"><a role="menuitem" class="ui-save-dropbox" tabindex="-1" href="#" target="_self"><i class="fa fa-dropbox fa-fw"></i> Dropbox</a>
|
||||
</li>
|
||||
|
@ -123,4 +128,4 @@
|
|||
</ul>
|
||||
</div>
|
||||
</nav>
|
||||
<div class="ui-spinner unselectable hidden-print"></div>
|
||||
<div class="ui-spinner unselectable hidden-print"></div>
|
|
@ -2,7 +2,13 @@
|
|||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Reveal.js</title>
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<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="stylesheet" href="/vendor/reveal.js/css/reveal.css">
|
||||
<link rel="stylesheet" href="/vendor/reveal.js/{{{theme}}}" id="theme">
|
||||
<!-- For syntax highlighting -->
|
||||
|
@ -19,7 +25,7 @@
|
|||
<div class="reveal">
|
||||
<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>
|
||||
|
@ -57,7 +63,7 @@
|
|||
progress: true,
|
||||
history: true,
|
||||
center: true,
|
||||
transition: 'default',
|
||||
transition: 'slide',
|
||||
dependencies: deps
|
||||
};
|
||||
|
Loading…
Reference in a new issue