shorten stuff in af_zz_vidmute

This commit is contained in:
Andrew Dolgov 2021-03-10 18:23:34 +03:00
parent 71b12857e0
commit 5e738ec278
1 changed files with 8 additions and 14 deletions

View File

@ -1,24 +1,18 @@
/* global require, PluginHost */
require(['dojo/_base/kernel', 'dojo/ready'], function (dojo, ready) {
function mute(row) {
[...row.querySelectorAll("video")].forEach((vid) => { vid.muted = true; });
}
ready(function () {
PluginHost.register(PluginHost.HOOK_ARTICLE_RENDERED_CDM, function (row) {
if (row) {
row.querySelectorAll("video").forEach(function (v) {
v.muted = true;
});
}
mute(row);
return true;
});
PluginHost.register(PluginHost.HOOK_ARTICLE_RENDERED, function (row) {
if (row) {
row.querySelectorAll("video").forEach(function (v) {
v.muted = true;
});
}
mute(row);
return true;
});
});