From c2965627b24069a9889b68f44142202e2ce57089 Mon Sep 17 00:00:00 2001 From: Tijn Kuyper Date: Wed, 2 Oct 2019 12:54:53 +0200 Subject: [PATCH] #647 - Tweak forum JS with poll plugin Hide JS when poll is not active in forums --- e107_plugins/forum/e_meta.php | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/e107_plugins/forum/e_meta.php b/e107_plugins/forum/e_meta.php index f76302b3c..51df968e3 100644 --- a/e107_plugins/forum/e_meta.php +++ b/e107_plugins/forum/e_meta.php @@ -2,14 +2,26 @@ if (!defined('e107_INIT')) { exit; } -// Moc - temporary solution until a global/common clone method is created which replaces duplicateHTML() -e107::js("footer-inline", " +// #647 - temporary solution until a global/common clone method is created which replaces duplicateHTML() +if(!e107::isInstalled('poll')) +{ + return; +} + +if(e107::getPlugPref('forum', 'poll') != '255') +{ + $poll_active = true; +} + +if(e_CURRENT_PLUGIN == "forum" && e107::isInstalled('poll') && $poll_active) +{ + e107::js("footer-inline", " + + $('#addoption').click(function () { + $('#poll_answer').clone().appendTo('#pollsection').find('input[type=text]').val(''); + }); + "); +} - $('#addoption').click(function () { - - $('#poll_answer').clone().appendTo('#pollsection').find('input[type=text]').val(''); - - }); - "); ?> \ No newline at end of file