more oembed fixes
This commit is contained in:
parent
1b00c75700
commit
ba1816a6fd
|
@ -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
|
||||
);
|
||||
|
|
|
@ -2182,20 +2182,14 @@ function buildAttachmentHTML(attachments){
|
|||
|
||||
var oembedBody = '';
|
||||
|
||||
try {
|
||||
var oembedStrippedHTML = $.trim($('<div>' + this.oembed.oembedHTML + '</div>').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) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user