diff --git a/public/src/forum/category.js b/public/src/forum/category.js index 0621b68019..094620bb9c 100644 --- a/public/src/forum/category.js +++ b/public/src/forum/category.js @@ -175,6 +175,9 @@ define(['composer', 'forum/pagination'], function(composer, pagination) { }); translator.translate(html, function(translatedHTML) { + translatedHTML = $(translatedHTML); + translatedHTML.find('img').addClass('img-responsive'); + recentReplies.html(translatedHTML); $('#category_recent_replies span.timeago').timeago(); diff --git a/public/src/utils.js b/public/src/utils.js index dd7985a2a8..3ecee02ee7 100644 --- a/public/src/utils.js +++ b/public/src/utils.js @@ -184,8 +184,20 @@ console.log(timestamp, e.stack); } return ''; - } + }, + + tags : ['a', 'abbr', 'acronym', 'address', 'applet', 'area', 'article', 'aside', 'audio', 'b', 'base', 'basefont', 'bdi', 'bdo', 'big', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', 'center', 'cite', 'code', 'col', 'colgroup', 'command', 'datalist', 'dd', 'del', 'details', 'dfn', 'dialog', 'dir', 'div', 'dl', 'dt', 'em', 'embed', 'fieldset', 'figcaption', 'figure', 'font', 'footer', 'form', 'frame', 'frameset', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hr', 'html', 'i', 'iframe', 'img', 'input', 'ins', 'kbd', 'keygen', 'label', 'legend', 'li', 'link', 'map', 'mark', 'menu', 'meta', 'meter', 'nav', 'noframes', 'noscript', 'object', 'ol', 'optgroup', 'option', 'output', 'p', 'param', 'pre', 'progress', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'script', 'section', 'select', 'small', 'source', 'span', 'strike', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'textarea', 'tfoot', 'th', 'thead', 'time', 'title', 'tr', 'track', 'tt', 'u', 'ul', 'var', 'video', 'wbr'], + getTagsExcept : function(excludeTags) { + var tagsToReturn = utils.tags.slice(); + excludeTags.forEach(function(tag) { + var index = tagsToReturn.indexOf(tag); + if(index !== -1) { + tagsToReturn.splice(index, 1); + } + }); + return tagsToReturn; + } }; diff --git a/src/posts.js b/src/posts.js index 25e0c2dd4c..f411c20fbb 100644 --- a/src/posts.js +++ b/src/posts.js @@ -298,7 +298,8 @@ var db = require('./database'), } if(stripTags) { - postData.content = S(content).stripTags().s; + var s = S(content); + postData.content = s.stripTags.apply(s, utils.getTagsExcept(['img', 'i'])).s; } else { postData.content = content; }