init.js 855 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. dojo.addOnLoad(function() {
  2. PluginHost.register(PluginHost.HOOK_ARTICLE_RENDERED_CDM, function(row) {
  3. if (row) {
  4. console.log("af_zz_noautoplay!");
  5. console.log(row);
  6. var videos = row.getElementsByTagName("video");
  7. console.log(row.innerHTML);
  8. for (i = 0; i < videos.length; i++) {
  9. videos[i].removeAttribute("autoplay");
  10. videos[i].pause();
  11. videos[i].onclick = function() {
  12. this.paused ? this.play() : this.pause();
  13. }
  14. }
  15. }
  16. return true;
  17. });
  18. PluginHost.register(PluginHost.HOOK_ARTICLE_RENDERED, function(row) {
  19. if (row) {
  20. var videos = row.getElementsByTagName("video");
  21. for (i = 0; i < videos.length; i++) {
  22. videos[i].removeAttribute("autoplay");
  23. videos[i].pause();
  24. videos[i].onclick = function() {
  25. this.paused ? this.play() : this.pause();
  26. }
  27. }
  28. }
  29. return true;
  30. });
  31. });