From b367e110b639ab707e848d1d6de70bb094cd0edd Mon Sep 17 00:00:00 2001 From: Wu Cheng-Han Date: Mon, 1 Aug 2016 00:08:22 +0800 Subject: [PATCH] Update to support slideOptions in the YAML metadata --- lib/models/note.js | 2 ++ lib/response.js | 1 + public/js/slide.js | 5 ++++- public/views/slide.ejs | 2 ++ 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/models/note.js b/lib/models/note.js index 5ee5c7d..05babb4 100644 --- a/lib/models/note.js +++ b/lib/models/note.js @@ -237,6 +237,8 @@ module.exports = function (sequelize, DataTypes) { _meta.robots = meta.robots; if (meta.GA && (typeof meta.GA == "string" || typeof meta.GA == "number")) _meta.GA = meta.GA; + if (meta.slideOptions && (typeof meta.slideOptions == "object")) + _meta.slideOptions = meta.slideOptions; } return _meta; } diff --git a/lib/response.js b/lib/response.js index 1a6d113..9df2ee9 100644 --- a/lib/response.js +++ b/lib/response.js @@ -555,6 +555,7 @@ function showPublishSlide(req, res, next) { title: title, description: meta.description, slides: slides, + slideOptions: JSON.stringify(meta.slideOptions || {}), GA: meta.GA, useCDN: config.usecdn }; diff --git a/public/js/slide.js b/public/js/slide.js index 074e4df..996610f 100644 --- a/public/js/slide.js +++ b/public/js/slide.js @@ -44,10 +44,13 @@ var defaultOptions = { dependencies: deps }; +// options from yaml meta +var options = JSON.parse($("#options").text()); + // options from URL query string var queryOptions = Reveal.getQueryHash() || {}; -var options = extend(defaultOptions, queryOptions); +var options = extend(defaultOptions, options, queryOptions); Reveal.initialize(options); viewAjaxCallback = function () { diff --git a/public/views/slide.ejs b/public/views/slide.ejs index b8ec00f..5817a20 100644 --- a/public/views/slide.ejs +++ b/public/views/slide.ejs @@ -50,6 +50,8 @@
<%- slides %>
+ +