Skip to content

Commit

Permalink
Merge pull request #51 from sandeepchhapola/master
Browse files Browse the repository at this point in the history
Fixed twice image display issue for rss feed content, ticket : #120475249
  • Loading branch information
DanielHindi committed Jun 1, 2016
2 parents 57f3eab + 5f0ad34 commit cdda8a2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
10 changes: 6 additions & 4 deletions widget/filters.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,13 @@
* @param html
*/
.filter('removeHtmlStyle', [function () {
return function (html) {
return function (html, src) {
if (html) {
html = html.replace(/(<[^>]+) style=".*?"/i, '$1', "");
html = html.replace(/<iframe.+?<\/iframe>/g, '');
html = html.replace(/(<a\b[^><]*)>/ig, '$1 target="_blank">');
var img = new RegExp('<img.*?src=\"' + src + '\".*?>');
html = html.replace(/(<[^>]+) style=".*?"/i, '$1', "");
html = html.replace(/<iframe.+?<\/iframe>/g, '');
html = html.replace(img, '');
html = html.replace(/(<a\b[^><]*)>/ig, '$1 target="_blank">');
}
return html;
};
Expand Down
2 changes: 1 addition & 1 deletion widget/templates/Feed_Layout_1.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
<!--<a class="text-primary">Share</a>-->
</div>
<hr class="small">
<p id="description" ng-bind-html="WidgetMedia.item.description|removeHtmlStyle|safeHtml"></p>
<p id="description" ng-bind-html="WidgetMedia.item.description|removeHtmlStyle:WidgetMedia.imageUrl|safeHtml"></p>
</div>
</div>
</div>
2 changes: 1 addition & 1 deletion widget/templates/Feed_Layout_2.html
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ <h5 class="margin-bottom-zero whiteTheme">{{WidgetMedia.item.summary|truncate:10
<!--<a class="text-primary">Share</a>-->
</div>
<hr class="small">
<p ng-bind-html="WidgetMedia.item.description|removeHtmlStyle|safeHtml"></p>
<p ng-bind-html="WidgetMedia.item.description|removeHtmlStyle:WidgetMedia.imageUrl|safeHtml"></p>
</div>
</div>
</div>

0 comments on commit cdda8a2

Please sign in to comment.