]> git.wh0rd.org - tt-rss.git/commitdiff
Merge branch 'master' of git.fakecake.org:tt-rss
authorAndrew Dolgov <noreply@fakecake.org>
Mon, 3 Aug 2015 16:21:12 +0000 (19:21 +0300)
committerAndrew Dolgov <noreply@fakecake.org>
Mon, 3 Aug 2015 16:21:12 +0000 (19:21 +0300)
js/viewfeed.js
plugins/af_zz_noautoplay/init.js [new file with mode: 0644]
plugins/af_zz_noautoplay/init.php [new file with mode: 0644]
plugins/instances/init.php
plugins/shorten_expanded/init.js

index d39416632f1a4499a061c0b6ea1561307d61909a..b5484b83a44578e31a7fc59dd0ac5dfc0f2a9012 100644 (file)
@@ -236,9 +236,8 @@ function render_article(article) {
                        c.domNode.scrollTop = 0;
                } catch (e) { };
 
-               PluginHost.run(PluginHost.HOOK_ARTICLE_RENDERED, article);
-
                c.attr('content', article);
+               PluginHost.run(PluginHost.HOOK_ARTICLE_RENDERED, c.domNode);
 
                correctHeadlinesOffset(getActiveArticleId());
 
@@ -1231,10 +1230,11 @@ function unpackVisibleHeadlines() {
                                        var cencw = $("CENCW-" + child.id.replace("RROW-", ""));
 
                                        if (cencw) {
-                                               PluginHost.run(PluginHost.HOOK_ARTICLE_RENDERED_CDM, child);
-
                                                cencw.innerHTML = htmlspecialchars_decode(cencw.innerHTML);
                                                cencw.setAttribute('id', '');
+
+                                               PluginHost.run(PluginHost.HOOK_ARTICLE_RENDERED_CDM, child);
+
                                                Element.show(cencw);
                                        }
                                }
diff --git a/plugins/af_zz_noautoplay/init.js b/plugins/af_zz_noautoplay/init.js
new file mode 100644 (file)
index 0000000..9b7bf00
--- /dev/null
@@ -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 (file)
index 0000000..a36dafa
--- /dev/null
@@ -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;
+       }
+
+}
+?>
index 947bc2a16e921dac1f080961aa16c655708515cc..1979af85d5e016e1abc1f6d0f23b64bcc504862a 100644 (file)
@@ -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\">";
 
index 4d80f840725ff06b0c9adf6886e4ff4daa15a01c..5e9e84aec56ff2d0cc2927b477da556ce92ae178 100644 (file)
@@ -41,5 +41,7 @@ dojo.addOnLoad(function() {
                                }
                        }, 150);
                }
+
+               return true;
        });
 });