mirror of
https://git.tt-rss.org/git/tt-rss.git
synced 2025-12-13 15:45:56 +00:00
add af_zz_noautoplay plugin
This commit is contained in:
40
plugins/af_zz_noautoplay/init.js
Normal file
40
plugins/af_zz_noautoplay/init.js
Normal file
@@ -0,0 +1,40 @@
|
||||
dojo.addOnLoad(function() {
|
||||
PluginHost.register(PluginHost.HOOK_ARTICLE_RENDERED_CDM, function(row) {
|
||||
if (row) {
|
||||
console.log("af_zz_noautoplay!");
|
||||
console.log(row);
|
||||
|
||||
var 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
});
|
||||
|
||||
PluginHost.register(PluginHost.HOOK_ARTICLE_RENDERED, function(row) {
|
||||
if (row) {
|
||||
var videos = row.getElementsByTagName("video");
|
||||
|
||||
for (i = 0; i < videos.length; i++) {
|
||||
videos[i].removeAttribute("autoplay");
|
||||
videos[i].pause();
|
||||
videos[i].onclick = function() {
|
||||
this.paused ? this.play() : this.pause();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
});
|
||||
|
||||
});
|
||||
Reference in New Issue
Block a user