From 3d5afa7c1751dd83ec9fd1f4f207f40e4e19e601 Mon Sep 17 00:00:00 2001 From: Agus Syahputra Date: Sun, 24 Jan 2016 13:32:53 +0700 Subject: [PATCH 1/8] Update library.js Update parse function and add support for jsBin --- library.js | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/library.js b/library.js index 2fea6c0..d753e6a 100644 --- a/library.js +++ b/library.js @@ -1,14 +1,17 @@ -(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 + .replace(/.+<\/a>/g, embed) + .replace(/.+<\/a>/g, embedJsBin); + callback(null, postContent); + }; - module.exports = jsFiddle; + module.exports = jsFiddle; }(module)); From 16ded0b8fb140acf54082390398d779990d023a8 Mon Sep 17 00:00:00 2001 From: Agus Syahputra Date: Sun, 24 Jan 2016 13:37:02 +0700 Subject: [PATCH 2/8] Update package.json --- package.json | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index a0ecbec..bb081e1 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" + }, } From 604422e116070cb822137c885a74333d8b59e5f6 Mon Sep 17 00:00:00 2001 From: Agus Syahputra Date: Sun, 24 Jan 2016 13:52:12 +0700 Subject: [PATCH 3/8] Update plugin.json --- plugin.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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" From e1d3e7d4ab3f732705e06bbe145896b4f5303984 Mon Sep 17 00:00:00 2001 From: Agus Syahputra Date: Sun, 24 Jan 2016 13:53:41 +0700 Subject: [PATCH 4/8] Remove unexpected comma --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index bb081e1..b55ff01 100644 --- a/package.json +++ b/package.json @@ -30,5 +30,5 @@ "_from": "nodebb-plugin-jsfiddle@~0.0.1", "nbbpm": { "compatibility": "^0.9.0" - }, + } } From 32f73eaba7367212380a411b6146f72d7202b820 Mon Sep 17 00:00:00 2001 From: Agus Syahputra Date: Sun, 24 Jan 2016 15:11:44 +0700 Subject: [PATCH 5/8] Update library.js --- library.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/library.js b/library.js index d753e6a..b5b1d71 100644 --- a/library.js +++ b/library.js @@ -2,15 +2,16 @@ "use strict"; var jsFiddle = {}, - embed = '', - embedJsBin = '' + embed = '', + embedJsBin = '' jsFiddle.parse = function (postContent, callback) { postContent.postData.content = postContent.postData.content - .replace(/.+<\/a>/g, embed) - .replace(/.+<\/a>/g, embedJsBin); + .replace(/.+<\/a>/g, embed) + .replace(/.+<\/a>/g, embedJsBin); callback(null, postContent); + console.log(postContent.postData.content) }; module.exports = jsFiddle; From f13678b3963b0d50ba504ab8a25078864210a154 Mon Sep 17 00:00:00 2001 From: Agus Syahputra Date: Sun, 24 Jan 2016 16:01:46 +0700 Subject: [PATCH 6/8] Update library.js --- library.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/library.js b/library.js index b5b1d71..c8533aa 100644 --- a/library.js +++ b/library.js @@ -2,16 +2,17 @@ "use strict"; var jsFiddle = {}, - embed = '', + embed = '', embedJsBin = '' jsFiddle.parse = function (postContent, callback) { postContent.postData.content = postContent.postData.content - .replace(/.+<\/a>/g, embed) + //We just want the first one or two segments after host name + .replace(/.+<\/a>/g, embed) + //We just the first one or more segments after host name .replace(/.+<\/a>/g, embedJsBin); callback(null, postContent); - console.log(postContent.postData.content) }; module.exports = jsFiddle; From 7588f2384ee08f33e0bb6964cdd72a02fe3e65be Mon Sep 17 00:00:00 2001 From: Agus Syahputra Date: Sun, 24 Jan 2016 16:09:00 +0700 Subject: [PATCH 7/8] Update library.js --- library.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library.js b/library.js index c8533aa..0fd983f 100644 --- a/library.js +++ b/library.js @@ -2,7 +2,7 @@ "use strict"; var jsFiddle = {}, - embed = '', + embed = '', embedJsBin = '' From aa0911f4225b807b51f59d439655c0aaed1c51a6 Mon Sep 17 00:00:00 2001 From: Agus Syahputra Date: Sat, 30 Jan 2016 07:33:42 +0700 Subject: [PATCH 8/8] Update library.js --- library.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library.js b/library.js index 0fd983f..37d866d 100644 --- a/library.js +++ b/library.js @@ -10,7 +10,7 @@ postContent.postData.content = postContent.postData.content //We just want the first one or two segments after host name .replace(/.+<\/a>/g, embed) - //We just the first one or more segments after host name + //We just want the first one or more segments after host name .replace(/.+<\/a>/g, embedJsBin); callback(null, postContent); };