1
0
mirror of https://tt-rss.org/git/tt-rss.git synced 2024-06-27 12:05:06 +02:00
ttrss/plugins/af_zz_noautoplay/init.js

42 lines
961 B
JavaScript
Raw Normal View History

require(['dojo/_base/kernel', 'dojo/ready'], function (dojo, ready) {
ready(function () {
PluginHost.register(PluginHost.HOOK_ARTICLE_RENDERED_CDM, function (row) {
if (row) {
console.log("af_zz_noautoplay!");
console.log(row);
2018-11-30 06:39:45 +01:00
const videos = row.getElementsByTagName("video");
console.log(row.innerHTML);
for (i = 0; i < videos.length; i++) {
videos[i].removeAttribute("autoplay");
videos[i].pause();
videos[i].onclick = function () {
this.paused ? this.play() : this.pause();
}
2015-07-31 12:42:22 +02:00
}
}
return true;
});
2015-07-31 12:42:22 +02:00
PluginHost.register(PluginHost.HOOK_ARTICLE_RENDERED, function (row) {
if (row) {
2018-11-30 06:39:45 +01:00
const videos = row.getElementsByTagName("video");
2015-07-31 12:42:22 +02:00
for (i = 0; i < videos.length; i++) {
videos[i].removeAttribute("autoplay");
videos[i].pause();
videos[i].onclick = function () {
this.paused ? this.play() : this.pause();
}
2015-07-31 12:42:22 +02:00
}
2015-07-31 12:42:22 +02:00
}
return true;
});
2015-07-31 12:42:22 +02:00
});
2018-11-30 06:39:45 +01:00
});