nodebb-plugin-github-card
Advanced tools
+6
-21
@@ -5,24 +5,9 @@ (function(module) { | ||
| Card.parse = function(postContent, callback) { | ||
| var re = /\[card.*?\]/gm; | ||
| var arr = postContent.match(re); | ||
| if(arr && arr.length == 1){ | ||
| var config = arr[0]; | ||
| config = config.replace(']', ''); | ||
| arr = config.split(':'); | ||
| if(arr.length == 2){ | ||
| arr = arr[1].split('|'); | ||
| var cardInfo = arr[0]; | ||
| var width = 400; | ||
| var height = 150; | ||
| if(arr.length == 2){ | ||
| arr = arr[1].split('*'); | ||
| if(arr.length == 2){ | ||
| width = arr[0]; | ||
| height = arr[1]; | ||
| } | ||
| } | ||
| var card = '<div class="github-card" data-github="'+cardInfo+'" data-width="'+width+'" data-height="'+height+'"></div><script src="/plugins/nodebb-plugin-github-card/static/widget.js"></script>' | ||
| postContent = postContent.replace(re, card); | ||
| } | ||
| var re = /\[card:(.*?)(\b|\|(.*?)\*(.*)?)\]/gm; | ||
| if (postContent.match(re)) { | ||
| var card = '<div class="github-card" data-github="$1" data-width="$3" data-height="$4"></div><script src="/plugins/nodebb-plugin-github-card/static/widget.js"></script>' | ||
| postContent = postContent.replace(re, card); | ||
| } | ||
| callback(null, postContent); | ||
@@ -29,0 +14,0 @@ }; |
+1
-1
| { | ||
| "name": "nodebb-plugin-github-card", | ||
| "version": "0.0.1", | ||
| "version": "0.0.2", | ||
| "description": "NodeBB plugin for github card", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
10824
-5.64%25
-40.48%