af_redditimgur: insert br after image

This commit is contained in:
Andrew Dolgov 2013-04-02 10:01:52 +04:00
parent ffd0786416
commit 7ff4d1fa8b

View file

@ -40,7 +40,9 @@ class Af_RedditImgur extends Plugin {
$img = $doc->createElement('img'); $img = $doc->createElement('img');
$img->setAttribute("src", $entry->getAttribute("href")); $img->setAttribute("src", $entry->getAttribute("href"));
$entry->parentNode->replaceChild($img, $entry); $br = $doc->createElement('br');
$entry->parentNode->insertBefore($img, $entry);
$entry->parentNode->insertBefore($br, $entry);
$found = true; $found = true;
} }
@ -66,7 +68,12 @@ class Af_RedditImgur extends Plugin {
if (preg_match("/^http:\/\/i.imgur.com\/$token\./", $aentry->getAttribute("src"))) { if (preg_match("/^http:\/\/i.imgur.com\/$token\./", $aentry->getAttribute("src"))) {
$img = $doc->createElement('img'); $img = $doc->createElement('img');
$img->setAttribute("src", $aentry->getAttribute("src")); $img->setAttribute("src", $aentry->getAttribute("src"));
$br = $doc->createElement('br');
$entry->parentNode->insertBefore($img, $entry); $entry->parentNode->insertBefore($img, $entry);
$entry->parentNode->insertBefore($br, $entry);
$found = true; $found = true;
break; break;
@ -94,7 +101,12 @@ class Af_RedditImgur extends Plugin {
$img = $doc->createElement('img'); $img = $doc->createElement('img');
$img->setAttribute("src", $aentry->getAttribute("href")); $img->setAttribute("src", $aentry->getAttribute("href"));
$entry->parentNode->insertBefore($doc->createElement('br'), $entry); $entry->parentNode->insertBefore($doc->createElement('br'), $entry);
$br = $doc->createElement('br');
$entry->parentNode->insertBefore($img, $entry); $entry->parentNode->insertBefore($img, $entry);
$entry->parentNode->insertBefore($br, $entry);
$found = true; $found = true;
} }
} }