diff options
author | Heiko Adams <[email protected]> | 2016-08-19 17:25:05 +0200 |
---|---|---|
committer | Heiko Adams <[email protected]> | 2016-08-19 17:25:05 +0200 |
commit | 2842cf6e4563d1665741dd4c151798e6e282c60b (patch) | |
tree | 6aa8c94dd1d3ae81976dd154ee6ca46eb31908f1 /plugins/af_zz_noautoplay/init.js | |
parent | 94e3a9ab44d82e0d7052d5e2e40496230b5f21a4 (diff) | |
parent | c565a0cc21a6ee3e74ac9bc0cf4bfdde7cc84efd (diff) |
Merge branch 'master' into german-translation
Diffstat (limited to 'plugins/af_zz_noautoplay/init.js')
-rw-r--r-- | plugins/af_zz_noautoplay/init.js | 61 |
1 files changed, 31 insertions, 30 deletions
diff --git a/plugins/af_zz_noautoplay/init.js b/plugins/af_zz_noautoplay/init.js index 9b7bf0077..45dfc55ab 100644 --- a/plugins/af_zz_noautoplay/init.js +++ b/plugins/af_zz_noautoplay/init.js @@ -1,40 +1,41 @@ -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(); +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); + + 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; - }); + return true; + }); - PluginHost.register(PluginHost.HOOK_ARTICLE_RENDERED, function(row) { - if (row) { - var videos = row.getElementsByTagName("video"); + 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(); + 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; + return true; + }); }); - });
\ No newline at end of file |