From: Andrew Dolgov Date: Sat, 23 Feb 2013 12:02:29 +0000 (+0400) Subject: add nsfw plugin X-Git-Tag: 1.7.1~55 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=1b9f9925cfc501828335efa17ae70fd0ac907d2c;p=tt-rss.git add nsfw plugin --- diff --git a/plugins/nsfw/init.js b/plugins/nsfw/init.js new file mode 100644 index 00000000..40ad2b0b --- /dev/null +++ b/plugins/nsfw/init.js @@ -0,0 +1,12 @@ +function nsfwShow(elem) { + try { + content = elem.parentNode.getElementsBySelector("div.nswf.content")[0]; + + if (content) { + Element.toggle(content); + } + + } catch (e) { + exception_error("nswfSHow", e); + } +} diff --git a/plugins/nsfw/init.php b/plugins/nsfw/init.php new file mode 100644 index 00000000..fd274ead --- /dev/null +++ b/plugins/nsfw/init.php @@ -0,0 +1,47 @@ +link = $host->get_link(); + $this->host = $host; + + $host->add_hook($host::HOOK_RENDER_ARTICLE, $this); + $host->add_hook($host::HOOK_RENDER_ARTICLE_CDM, $this); + + } + + function get_js() { + return file_get_contents(dirname(__FILE__) . "/init.js"); + } + + function hook_render_article($article) { + + if (array_search("nsfw", $article["tags"]) !== FALSE) { + $article["content"] = "
+
"; + } + + return $article; + } + + function hook_render_article_cdm($article) { + if (array_search("nsfw", $article["tags"]) !== FALSE) { + $article["content"] = "
+
"; + } + + return $article; + } + +} +?>