From fa42b26cb19724a2067c925f4ee2d11edad2ea88 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Fri, 7 May 2021 15:04:38 +0300 Subject: initial --- init.js | 23 +++++++++++++++++++++++ init.php | 23 +++++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 init.js create mode 100644 init.php diff --git a/init.js b/init.js new file mode 100644 index 0000000..c7c1138 --- /dev/null +++ b/init.js @@ -0,0 +1,23 @@ +/* global require, PluginHost */ + +require(['dojo/_base/kernel', 'dojo/ready'], function (dojo, ready) { + function unpreload(vid) { + vid.setAttribute("preload", "none"); + } + + function unpreload_all(row) { + [...row.querySelectorAll("video")].forEach((vid) => unpreload(vid)); + } + + ready(function () { + PluginHost.register(PluginHost.HOOK_ARTICLE_RENDERED_CDM, function (row) { + unpreload_all(row); + return true; + }); + + PluginHost.register(PluginHost.HOOK_ARTICLE_RENDERED, function (row) { + unpreload_all(row); + return true; + }); + }); +}); diff --git a/init.php b/init.php new file mode 100644 index 0000000..89d51eb --- /dev/null +++ b/init.php @@ -0,0 +1,23 @@ +host = $host; + } + + function get_js() { + return file_get_contents(__DIR__ . "/init.js"); + } + + function api_version() { + return 2; + } + +} -- cgit v1.2.3