diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/af_zz_noautoplay/init.js | 40 | ||||
-rw-r--r-- | plugins/af_zz_noautoplay/init.php | 24 | ||||
-rw-r--r-- | plugins/instances/init.php | 4 | ||||
-rw-r--r-- | plugins/shorten_expanded/init.js | 2 |
4 files changed, 68 insertions, 2 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 diff --git a/plugins/af_zz_noautoplay/init.php b/plugins/af_zz_noautoplay/init.php new file mode 100644 index 000000000..a36dafa96 --- /dev/null +++ b/plugins/af_zz_noautoplay/init.php @@ -0,0 +1,24 @@ +<?php +class Af_Zz_NoAutoPlay extends Plugin { + private $host; + + function about() { + return array(1.0, + "Don't autoplay HTML5 videos", + "fox"); + } + + function init($host) { + $this->host = $host; + } + + function get_js() { + return file_get_contents(__DIR__ . "/init.js"); + } + + function api_version() { + return 2; + } + +} +?> diff --git a/plugins/instances/init.php b/plugins/instances/init.php index 947bc2a16..1979af85d 100644 --- a/plugins/instances/init.php +++ b/plugins/instances/init.php @@ -226,7 +226,7 @@ class Instances extends Plugin implements IHandler { print __("Access key:") . " "; print "<input dojoType=\"dijit.form.ValidationTextBox\" required=\"1\" - placeHolder=\"".__("Access key")."\" regExp='\w{40}' + placeHolder=\"".__("Access key")."\" style=\"width: 20em\" name=\"access_key\" id=\"instance_edit_key\" value=\"$access_key\">"; @@ -414,7 +414,7 @@ class Instances extends Plugin implements IHandler { print __("Access key:") . " "; print "<input dojoType=\"dijit.form.ValidationTextBox\" required=\"1\" - placeHolder=\"".__("Access key")."\" regExp='\w{40}' + placeHolder=\"".__("Access key")."\" style=\"width: 20em\" name=\"access_key\" id=\"instance_add_key\" value=\"$access_key\">"; diff --git a/plugins/shorten_expanded/init.js b/plugins/shorten_expanded/init.js index 4d80f8407..5e9e84aec 100644 --- a/plugins/shorten_expanded/init.js +++ b/plugins/shorten_expanded/init.js @@ -41,5 +41,7 @@ dojo.addOnLoad(function() { } }, 150); } + + return true; }); }); |