diff --git a/QvitterPlugin.php b/QvitterPlugin.php index 270ea3e..1be1692 100644 --- a/QvitterPlugin.php +++ b/QvitterPlugin.php @@ -517,10 +517,13 @@ class QvitterPlugin extends Plugin { if(array_key_exists('Oembed', StatusNet::getActivePlugins())) { $oembed = File_oembed::getKV('file_id',$attachment->id); if($oembed instanceof File_oembed) { + $oembed_html = str_replace('<!--//-->','',$oembed->html); // trash left of wordpress' javascript after htmLawed removed the tags + $oembed_html = str_replace('…','...',$oembed_html); // ellipsis is sometimes stored as html in db, for some reason + $oembed_html = strip_tags($oembed_html); $attachment_url_to_id[$enclosure_o->url]['oembed'] = array( 'provider'=> $oembed->provider, 'provider_url'=> $oembed->provider_url, - 'oembedHTML'=> strip_tags($oembed->html), + 'oembedHTML'=> $oembed_html, 'title'=> $oembed->title, 'author_url'=> $oembed->author_url ); diff --git a/js/dom-functions.js b/js/dom-functions.js index 1b29f6c..8cb8a70 100644 --- a/js/dom-functions.js +++ b/js/dom-functions.js @@ -2182,20 +2182,14 @@ function buildAttachmentHTML(attachments){ var oembedBody = ''; - try { - var oembedStrippedHTML = $.trim($('
' + this.oembed.oembedHTML + '
').text().replace('','')); - } - catch(e) { - var oembedStrippedHTML = ''; - } - // not if stripped from html it's the same as the title (wordpress does this..) + // not if html it's the same as the title (wordpress does this..) if(this.oembed.oembedHTML !== null - && oembedStrippedHTML.length > 0 - && oembedStrippedHTML != $.trim(this.oembed.title)) { - if(oembedStrippedHTML.length > 160) { - oembedStrippedHTML = oembedStrippedHTML.substring(0,250) + '…'; + && this.oembed.oembedHTML.length > 0 + && $.trim(this.oembed.oembedHTML) != $.trim(this.oembed.title)) { + if(this.oembed.oembedHTML.length > 200) { + this.oembed.oembedHTML = this.oembed.oembedHTML.substring(0,200) + '…'; } - oembedBody = oembedStrippedHTML; + oembedBody = this.oembed.oembedHTML; } if(this.oembed.provider === null) {