]> git.wh0rd.org - tt-rss.git/commitdiff
add af_zz_vidmute
authorAndrew Dolgov <noreply@fakecake.org>
Mon, 13 Feb 2017 16:21:38 +0000 (19:21 +0300)
committerAndrew Dolgov <noreply@fakecake.org>
Mon, 13 Feb 2017 16:21:38 +0000 (19:21 +0300)
plugins/af_zz_vidmute/init.js [new file with mode: 0644]
plugins/af_zz_vidmute/init.php [new file with mode: 0644]

diff --git a/plugins/af_zz_vidmute/init.js b/plugins/af_zz_vidmute/init.js
new file mode 100644 (file)
index 0000000..8968792
--- /dev/null
@@ -0,0 +1,25 @@
+require(['dojo/_base/kernel', 'dojo/ready'], function  (dojo, ready) {
+       ready(function () {
+               PluginHost.register(PluginHost.HOOK_ARTICLE_RENDERED_CDM, function (row) {
+                       if (row) {
+
+                               row.select("video").each(function (v) {
+                                       v.setAttribute("muted", true);
+                               });
+                       }
+
+                       return true;
+               });
+
+               PluginHost.register(PluginHost.HOOK_ARTICLE_RENDERED, function (row) {
+                       if (row) {
+
+                               row.select("video").each(function (v) {
+                                       v.setAttribute("muted", true);
+                               });
+                       }
+
+                       return true;
+               });
+       });
+});
\ No newline at end of file
diff --git a/plugins/af_zz_vidmute/init.php b/plugins/af_zz_vidmute/init.php
new file mode 100644 (file)
index 0000000..e1da850
--- /dev/null
@@ -0,0 +1,24 @@
+<?php
+class Af_Zz_VidMute extends Plugin {
+       private $host;
+
+       function about() {
+               return array(1.0,
+                       "Mute audio in HTML5 videos",
+                       "fox");
+       }
+
+       function init($host) {
+               $this->host = $host;
+       }
+
+       function get_js() {
+               return file_get_contents(__DIR__ . "/init.js");
+       }
+
+       function api_version() {
+               return 2;
+       }
+
+}
+?>