From fc756975abf749fb927550555b533040e94ac6f7 Mon Sep 17 00:00:00 2001 From: Dave Z Date: Wed, 7 Feb 2018 06:52:36 +0000 Subject: [PATCH 1/2] af_comics: Allow subscribing to GoComics URLs via page (only this time, *actually allow* it). --- plugins/af_comics/init.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/plugins/af_comics/init.php b/plugins/af_comics/init.php index 66c48fcf5..255ae7239 100755 --- a/plugins/af_comics/init.php +++ b/plugins/af_comics/init.php @@ -14,6 +14,7 @@ class Af_Comics extends Plugin { $this->host = $host; $host->add_hook($host::HOOK_FETCH_FEED, $this); + $host->add_hook($host::HOOK_SUBSCRIBE_FEED, $this); $host->add_hook($host::HOOK_ARTICLE_FILTER, $this); $host->add_hook($host::HOOK_PREFS_TAB, $this); @@ -151,6 +152,16 @@ class Af_Comics extends Plugin { return $feed_data; } + function hook_subscribe_feed($contents, $url, $auth_login, $auth_pass) { + if ($auth_login || $auth_pass) + return $contents; + + if (preg_match('#^https?://www\.gocomics\.com/([-a-z0-9]+)$#i', $url)) + return ''; // Get is_html() to return false. + + return $contents; + } + function api_version() { return 2; } From d92fcaa9c86509265118201d8b9d2ab82f0fdb42 Mon Sep 17 00:00:00 2001 From: Dave Z Date: Wed, 7 Feb 2018 16:57:32 +0000 Subject: [PATCH 2/2] af_comics: Workaround for GoComics' lazy loading images in srcset. --- plugins/af_comics/init.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/plugins/af_comics/init.php b/plugins/af_comics/init.php index 255ae7239..d59a654d7 100755 --- a/plugins/af_comics/init.php +++ b/plugins/af_comics/init.php @@ -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);