diff options
author | Andrew Dolgov <[email protected]> | 2019-05-07 08:09:07 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2019-05-07 08:09:07 +0300 |
commit | e0ef3cc4f1837c4d98dccd10dfe51a1ed9c41963 (patch) | |
tree | d5755120c8b8ccf9cf49eb3d042bc62bba24cfed |
initial
-rw-r--r-- | README.md | 7 | ||||
-rw-r--r-- | init.php | 28 |
2 files changed, 35 insertions, 0 deletions
diff --git a/README.md b/README.md new file mode 100644 index 0000000..af210cd --- /dev/null +++ b/README.md @@ -0,0 +1,7 @@ +## Workaround for Chrome issue #945117 + +https://discourse.tt-rss.org/t/android-article-load-very-slow-with-chrome-72-73/ + +## Installation + +Git clone to /plugins.local/api_content_lang diff --git a/init.php b/init.php new file mode 100644 index 0000000..d6772f6 --- /dev/null +++ b/init.php @@ -0,0 +1,28 @@ +<?php +class Api_Content_Lang extends Plugin { + private $host; + + function about() { + return array(1.0, + "Sets lang=zh to article content returned via API (Chrome issue workaround)", + "fox"); + } + + function init($host) { + $this->host = $host; + + $host->add_hook($host::HOOK_RENDER_ARTICLE_API, $this); + } + + function hook_render_article_api($row) { + $article = isset($row['headline']) ? $row['headline'] : $row['article']; + + $article['content'] = "<div lang='zh'>" . $article['content'] . "</div>"; + + return $article; + } + + function api_version() { + return 2; + } +} |