Merge branch 'master' of git.fakecake.org:tt-rss

This commit is contained in:
Andrew Dolgov 2015-08-03 19:21:12 +03:00
commit 978eb54582
5 changed files with 72 additions and 6 deletions

View File

@ -236,9 +236,8 @@ function render_article(article) {
c.domNode.scrollTop = 0; c.domNode.scrollTop = 0;
} catch (e) { }; } catch (e) { };
PluginHost.run(PluginHost.HOOK_ARTICLE_RENDERED, article);
c.attr('content', article); c.attr('content', article);
PluginHost.run(PluginHost.HOOK_ARTICLE_RENDERED, c.domNode);
correctHeadlinesOffset(getActiveArticleId()); correctHeadlinesOffset(getActiveArticleId());
@ -1231,10 +1230,11 @@ function unpackVisibleHeadlines() {
var cencw = $("CENCW-" + child.id.replace("RROW-", "")); var cencw = $("CENCW-" + child.id.replace("RROW-", ""));
if (cencw) { if (cencw) {
PluginHost.run(PluginHost.HOOK_ARTICLE_RENDERED_CDM, child);
cencw.innerHTML = htmlspecialchars_decode(cencw.innerHTML); cencw.innerHTML = htmlspecialchars_decode(cencw.innerHTML);
cencw.setAttribute('id', ''); cencw.setAttribute('id', '');
PluginHost.run(PluginHost.HOOK_ARTICLE_RENDERED_CDM, child);
Element.show(cencw); Element.show(cencw);
} }
} }

View File

@ -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;
});
});

View File

@ -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;
}
}
?>

View File

@ -226,7 +226,7 @@ class Instances extends Plugin implements IHandler {
print __("Access key:") . " "; print __("Access key:") . " ";
print "<input dojoType=\"dijit.form.ValidationTextBox\" required=\"1\" 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\" style=\"width: 20em\" name=\"access_key\" id=\"instance_edit_key\"
value=\"$access_key\">"; value=\"$access_key\">";
@ -414,7 +414,7 @@ class Instances extends Plugin implements IHandler {
print __("Access key:") . " "; print __("Access key:") . " ";
print "<input dojoType=\"dijit.form.ValidationTextBox\" required=\"1\" 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\" style=\"width: 20em\" name=\"access_key\" id=\"instance_add_key\"
value=\"$access_key\">"; value=\"$access_key\">";

View File

@ -41,5 +41,7 @@ dojo.addOnLoad(function() {
} }
}, 150); }, 150);
} }
return true;
}); });
}); });