diff --git a/library.js b/library.js
index 2fea6c0..37d866d 100644
--- a/library.js
+++ b/library.js
@@ -1,14 +1,19 @@
-(function(module) {
- "use strict";
+(function (module) {
+ "use strict";
- var jsFiddle = {},
- embed = '';
+ var jsFiddle = {},
+ embed = '',
+ embedJsBin = ''
- jsFiddle.parse = function(postContent, callback) {
- postContent = postContent.replace(/.+<\/a>/g, embed);
- callback(null, postContent);
- };
+ jsFiddle.parse = function (postContent, callback) {
+ postContent.postData.content = postContent.postData.content
+ //We just want the first one or two segments after host name
+ .replace(/.+<\/a>/g, embed)
+ //We just want the first one or more segments after host name
+ .replace(/.+<\/a>/g, embedJsBin);
+ callback(null, postContent);
+ };
- module.exports = jsFiddle;
+ module.exports = jsFiddle;
}(module));
diff --git a/package.json b/package.json
index a0ecbec..b55ff01 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "nodebb-plugin-jsfiddle",
- "version": "0.0.1",
+ "version": "0.0.2",
"description": "NodeBB jsFiddle Plugin",
"main": "library.js",
"scripts": {
@@ -27,5 +27,8 @@
"readme": "",
"readmeFilename": "README.md",
"_id": "nodebb-plugin-jsfiddle@0.0.1",
- "_from": "nodebb-plugin-jsfiddle@~0.0.1"
+ "_from": "nodebb-plugin-jsfiddle@~0.0.1",
+ "nbbpm": {
+ "compatibility": "^0.9.0"
+ }
}
diff --git a/plugin.json b/plugin.json
index c522abc..a3045a4 100644
--- a/plugin.json
+++ b/plugin.json
@@ -5,7 +5,7 @@
"url": "https://github.com/a5mith/nodebb-plugin-jsfiddle",
"library": "./library.js",
"hooks": [
- { "hook": "filter:post.parse", "method": "parse", "callbacked": true }
+ { "hook": "filter:parse.post", "method": "parse", "callbacked": true }
],
"staticDirs": {
"css": "./static"