diff --git a/app.js b/app.js index 8ebcaacf..64b5b5f8 100644 --- a/app.js +++ b/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 diff --git a/lib/response.js b/lib/response.js index 640e83bf..375fc3f4 100644 --- a/lib/response.js +++ b/lib/response.js @@ -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, diff --git a/public/js/index.js b/public/js/index.js index 4706d210..88410749 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -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) { diff --git a/public/views/header.ejs b/public/views/header.ejs index 47246a1d..c98202c0 100644 --- a/public/views/header.ejs +++ b/public/views/header.ejs @@ -21,14 +21,18 @@ -