From d8e8e24e34463bd5b7f0f76ca290a3a1e4a5f2c7 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Fri, 31 Jul 2015 13:42:05 +0300 Subject: pass DOMNodes instead of escaped html data to JS article rendered hooks (i think this makes much more sense) --- js/viewfeed.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/js/viewfeed.js b/js/viewfeed.js index d39416632..b5484b83a 100644 --- a/js/viewfeed.js +++ b/js/viewfeed.js @@ -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); } } -- cgit v1.2.3 From 1dbc8d6062e3784cc9fe0637c70f461a2047af2e Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Fri, 31 Jul 2015 13:42:22 +0300 Subject: add af_zz_noautoplay plugin --- plugins/af_zz_noautoplay/init.js | 40 +++++++++++++++++++++++++++++++++++++++ plugins/af_zz_noautoplay/init.php | 24 +++++++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 plugins/af_zz_noautoplay/init.js create mode 100644 plugins/af_zz_noautoplay/init.php 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 @@ +host = $host; + } + + function get_js() { + return file_get_contents(__DIR__ . "/init.js"); + } + + function api_version() { + return 2; + } + +} +?> -- cgit v1.2.3 From 6fd79b12a55eb2fa7f156650a7734b209cb2c6f5 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Fri, 31 Jul 2015 13:42:39 +0300 Subject: update shorten_expanded to allow other JS hooks to process article, duh --- plugins/shorten_expanded/init.js | 2 ++ 1 file changed, 2 insertions(+) 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; }); }); -- cgit v1.2.3 From ee15687a9330e6135185b163f6e66f26205b762b Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Mon, 3 Aug 2015 16:12:42 +0300 Subject: instances plugin: do not validate secretkey format --- plugins/instances/init.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/instances/init.php b/plugins/instances/init.php index b23f45a01..0308d3fb2 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 ""; @@ -414,7 +414,7 @@ class Instances extends Plugin implements IHandler { print __("Access key:") . " "; print ""; -- cgit v1.2.3