diff --git a/.gitmodules b/.gitmodules
index 1c9f545..f4b3b44 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,6 +1,6 @@
[submodule "deps/Sanitize.js"]
path = deps/Sanitize.js
- url = https://github.com/gbirke/Sanitize.js.git
+ url = https://github.com/thedod/Sanitize.js.git
[submodule "deps/jwysiwyg"]
path = deps/jwysiwyg
url = https://github.com/akzhan/jwysiwyg.git
diff --git a/deps/Sanitize.js b/deps/Sanitize.js
new file mode 160000
index 0000000..a0bdb6f
--- /dev/null
+++ b/deps/Sanitize.js
@@ -0,0 +1 @@
+Subproject commit a0bdb6f9647d677273d83df678f494cb5852b42f
diff --git a/lib/lists.js b/lib/lists.js
index 87fab92..8da625c 100644
--- a/lib/lists.js
+++ b/lib/lists.js
@@ -8,6 +8,7 @@ exports.homepage = function (head, req) {
start({code: 200, headers: {'Content-Type': 'text/html'}});
+ var title = config.site_name;
// fetch all the rows
var row, rows = [];
while (row = getRow()) {
@@ -19,8 +20,14 @@ exports.homepage = function (head, req) {
rows: rows
});
- return {title: config.site_name, config: config, content: content};
-
+ if (req.client) {
+ document.title = title;
+ $('#breadcrumbs').html('');
+ $('#content').html(content);
+ $('#actions').html(templates.render('blogposts_actions.html',req,{}));
+ } else {
+ return {title: title, config: config, content: content, breadcrumbs:''};
+ };
};
exports.carousel = function (head, req) {
diff --git a/lib/sanitize b/lib/sanitize
new file mode 120000
index 0000000..d88c150
--- /dev/null
+++ b/lib/sanitize
@@ -0,0 +1 @@
+../deps/Sanitize.js/lib
\ No newline at end of file
diff --git a/lib/shows.js b/lib/shows.js
index 8da1916..6478979 100644
--- a/lib/shows.js
+++ b/lib/shows.js
@@ -4,24 +4,47 @@
var templates = require('kanso/templates'),
forms = require('kanso/forms'),
+ utils = require('kanso/utils'),
config = require('./config'),
types = require('./types');
exports.not_found = function (doc, req) {
+ start({code: 200, headers: {'Content-Type': 'text/html'}});
return {
title: config.site_name+" - Not found",
- content: templates.render('404.html', req, {})
+ content: templates.render('404.html', req, {}),
+ breadcrumbs: 'Not found'
};
};
exports.blogpost = function (doc, req) {
+ var title = config.site_name+' - '+doc.title;
+ var breadcrumbs = utils.escapeHTML(doc.title);
+ start({code: 200, headers: {'Content-Type': 'text/html'}});
+ if (req.client) {
+ document.title = title;
+ $('#breadcrumbs').html(breadcrumbs);
+ var cfg = require('./sanitize/sanitize_cfg_relaxed').Config;
+ // Add rel and target to all links
+ cfg.add_attributes={a:{rel:'nofollow', target:'_blank'}};
+ var Sanitize = require('./sanitize/sanitize').Sanitize;
+ var stz = new Sanitize(cfg);
+ // We need to defuse script tags before sanitizing, because $('') *would* execute
+ $('#content').html(stz.clean_node(
+ $(''+doc.text.replace(/
-
{title}
{>"session.html"/}
-
+
+ {>"flashmessages.html"/}
{content|s}
+
+
-
+
+
+
+
+
+
+