mirror of
https://git.tt-rss.org/git/tt-rss.git
synced 2025-12-13 08:15:55 +00:00
shorten_expanded: remove loading=lazy from images if enabled
This commit is contained in:
@@ -11,6 +11,21 @@ class Shorten_Expanded extends Plugin {
|
|||||||
function init($host) {
|
function init($host) {
|
||||||
$this->host = $host;
|
$this->host = $host;
|
||||||
|
|
||||||
|
$host->add_hook($host::HOOK_SANITIZE, $this);
|
||||||
|
}
|
||||||
|
|
||||||
|
// native lazy loading messes with plugin height calculation because images get loaded
|
||||||
|
// after headline is actually rendered (off screen) so we force disable it
|
||||||
|
function hook_sanitize($doc) {
|
||||||
|
$xpath = new DOMXPath($doc);
|
||||||
|
|
||||||
|
$entries = $xpath->query('(//*[@loading="lazy"])');
|
||||||
|
|
||||||
|
foreach ($entries as $entry) {
|
||||||
|
$entry->removeAttribute("loading");
|
||||||
|
}
|
||||||
|
|
||||||
|
return $doc;
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_css() {
|
function get_css() {
|
||||||
|
|||||||
Reference in New Issue
Block a user