]> git.wh0rd.org Git - tt-rss.git/commitdiff
af_comics: Workaround for GoComics' lazy loading images in srcset.
authorDave Z <donotreply@example.com>
Wed, 7 Feb 2018 16:57:32 +0000 (16:57 +0000)
committerDave Z <donotreply@example.com>
Wed, 7 Feb 2018 16:57:32 +0000 (16:57 +0000)
plugins/af_comics/init.php

index 255ae72392f4cbe5d9162c00b16b94c550c263f5..d59a654d73e5dd8eaa96bd19ccea3f6211c1b1c6 100755 (executable)
@@ -126,6 +126,15 @@ class Af_Comics extends Plugin {
                                        if ($node) {
                                            $node->removeAttribute("width");
 
+                                               if ($node->hasAttribute("srcset") && preg_match("|/transparent\.png$|", $node->getAttribute("srcset"))) {
+                                                       if ($node->hasAttribute("data-srcset")) {
+                                                               $node->setAttribute("srcset", $node->getAttribute("data-srcset"));
+                                                               $node->removeAttribute("data-srcset");
+                                                       } elseif ($node->hasAttribute("src")) {
+                                                               $node->remoteAttribute("srcset");
+                                                       }
+                                               }
+
                                                $tpl->setVariable('ARTICLE_ID', $article_link, true);
                                                $tpl->setVariable('ARTICLE_LINK', $article_link, true);
                                                $tpl->setVariable('ARTICLE_TITLE', date('l, F d, Y'), true);