From 182a07ddb4f79e808e190cdc9f07ad7aaf3f53c0 Mon Sep 17 00:00:00 2001 From: barisusakli Date: Wed, 4 May 2016 12:17:07 +0300 Subject: [PATCH] closes https://github.com/NodeBB/NodeBB/issues/4594, closes https://github.com/NodeBB/NodeBB/issues/4441 --- library.js | 16 ++++++++++++++++ plugin.json | 5 ++++- 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 library.js diff --git a/library.js b/library.js new file mode 100644 index 0000000..9996cb1 --- /dev/null +++ b/library.js @@ -0,0 +1,16 @@ +'use strict'; + +var S = require.main.require('string'); + +var library = {}; + +library.getTeasers = function(data, callback) { + data.teasers.forEach(function(teaser) { + if (teaser && teaser.content) { + teaser.content = S(teaser.content).stripTags('img').s; + } + }); + callback(null, data); +}; + +module.exports = library; \ No newline at end of file diff --git a/plugin.json b/plugin.json index 4f08c5d..2413b30 100644 --- a/plugin.json +++ b/plugin.json @@ -1,6 +1,9 @@ { "id": "nodebb-theme-persona", - "hooks": [], + "library": "library.js", + "hooks": [ + { "hook": "filter:teasers.get", "method": "getTeasers" } + ], "scripts": [ "lib/persona.js", "lib/modules/nprogress.js",