diff options
author | Andrew Dolgov <[email protected]> | 2015-08-03 19:21:12 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2015-08-03 19:21:12 +0300 |
commit | 978eb545821d8f700e1f62b7da6a4ca0fc38adb8 (patch) | |
tree | 795b0f0ee1c73ddd94ff92bc8e3452fd41533c57 /plugins/af_zz_noautoplay/init.js | |
parent | 3ceb893f66920383b0f79faf1fc896469ee3d2a4 (diff) | |
parent | ee15687a9330e6135185b163f6e66f26205b762b (diff) |
Merge branch 'master' of git.fakecake.org:tt-rss
Diffstat (limited to 'plugins/af_zz_noautoplay/init.js')
-rw-r--r-- | plugins/af_zz_noautoplay/init.js | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/plugins/af_zz_noautoplay/init.js b/plugins/af_zz_noautoplay/init.js new file mode 100644 index 000000000..9b7bf0077 --- /dev/null +++ b/plugins/af_zz_noautoplay/init.js @@ -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; + }); + +});
\ No newline at end of file |