]> git.wh0rd.org - tt-rss.git/blob - plugins/af_zz_noautoplay/init.js
plugins: run eslint const/let fixes
[tt-rss.git] / plugins / af_zz_noautoplay / init.js
1 require(['dojo/_base/kernel', 'dojo/ready'], function (dojo, ready) {
2 ready(function () {
3 PluginHost.register(PluginHost.HOOK_ARTICLE_RENDERED_CDM, function (row) {
4 if (row) {
5 console.log("af_zz_noautoplay!");
6 console.log(row);
7
8 const videos = row.getElementsByTagName("video");
9 console.log(row.innerHTML);
10
11 for (i = 0; i < videos.length; i++) {
12
13 videos[i].removeAttribute("autoplay");
14 videos[i].pause();
15 videos[i].onclick = function () {
16 this.paused ? this.play() : this.pause();
17 }
18 }
19 }
20
21 return true;
22 });
23
24 PluginHost.register(PluginHost.HOOK_ARTICLE_RENDERED, function (row) {
25 if (row) {
26 const videos = row.getElementsByTagName("video");
27
28 for (i = 0; i < videos.length; i++) {
29 videos[i].removeAttribute("autoplay");
30 videos[i].pause();
31 videos[i].onclick = function () {
32 this.paused ? this.play() : this.pause();
33 }
34 }
35
36 }
37
38 return true;
39 });
40 });
41 });