<?php

use Twig\Environment;
use Twig\Error\LoaderError;
use Twig\Error\RuntimeError;
use Twig\Extension\SandboxExtension;
use Twig\Markup;
use Twig\Sandbox\SecurityError;
use Twig\Sandbox\SecurityNotAllowedTagError;
use Twig\Sandbox\SecurityNotAllowedFilterError;
use Twig\Sandbox\SecurityNotAllowedFunctionError;
use Twig\Source;
use Twig\Template;

/* overall_footer_simplified.html */
class __TwigTemplate_195c49626ce5691a95ef3d3a0e726de4 extends \Twig\Template
{
    private $source;
    private $macros = [];

    public function __construct(Environment $env)
    {
        parent::__construct($env);

        $this->source = $this->getSourceContext();

        $this->parent = false;

        $this->blocks = [
        ];
    }

    protected function doDisplay(array $context, array $blocks = [])
    {
        $macros = $this->macros;
        // line 1
        echo "
            <div>
                <a id=\"bottom\" class=\"anchor\" accesskey=\"z\"></a>
                ";
        // line 4
        if ( !($context["S_IS_BOT"] ?? null)) {
            echo ($context["RUN_CRON_TASK"] ?? null);
        }
        // line 5
        echo "            </div>

            <script type=\"text/javascript\" src=\"";
        // line 7
        echo ($context["T_JQUERY_LINK"] ?? null);
        echo "\"></script>

            ";
        // line 9
        if (($context["S_ALLOW_CDN"] ?? null)) {
            // line 10
            echo "                <script type=\"text/javascript\">window.jQuery || document.write('\\x3Cscript src=\"";
            echo ($context["T_ASSETS_PATH"] ?? null);
            echo "/javascript/jquery.min.js?assets_version=";
            echo ($context["T_ASSETS_VERSION"] ?? null);
            echo "\">\\x3C/script>');</script>
            ";
        }
        // line 12
        echo "
            <script type=\"text/javascript\" src=\"";
        // line 13
        echo ($context["T_ASSETS_PATH"] ?? null);
        echo "/javascript/core.js?assets_version=";
        echo ($context["T_ASSETS_VERSION"] ?? null);
        echo "\"></script>
            ";
        // line 14
        $asset_file = "forum_fn.js";
        $asset = new \phpbb\template\asset($asset_file, $this->env->get_path_helper(), $this->env->get_filesystem());
        if (substr($asset_file, 0, 2) !== './' && $asset->is_relative()) {
            $asset_path = $asset->get_path();            $local_file = $this->env->get_phpbb_root_path() . $asset_path;
            if (!file_exists($local_file)) {
                $local_file = $this->env->findTemplate($asset_path);
                $asset->set_path($local_file, true);
            }
        }
        
        if ($asset->is_relative()) {
            $asset->add_assets_version($this->env->get_phpbb_config()['assets_version']);
        }
        $this->env->get_assets_bag()->add_script($asset);        // line 15
        echo "            ";
        $asset_file = "ajax.js";
        $asset = new \phpbb\template\asset($asset_file, $this->env->get_path_helper(), $this->env->get_filesystem());
        if (substr($asset_file, 0, 2) !== './' && $asset->is_relative()) {
            $asset_path = $asset->get_path();            $local_file = $this->env->get_phpbb_root_path() . $asset_path;
            if (!file_exists($local_file)) {
                $local_file = $this->env->findTemplate($asset_path);
                $asset->set_path($local_file, true);
            }
        }
        
        if ($asset->is_relative()) {
            $asset->add_assets_version($this->env->get_phpbb_config()['assets_version']);
        }
        $this->env->get_assets_bag()->add_script($asset);        // line 16
        echo "
            ";
        // line 17
        if (($context["S_ALLOW_CDN"] ?? null)) {
            // line 18
            echo "                <script type=\"text/javascript\">
                    (function(\$){
                        var \$fa_cdn = \$('head').find('link[rel=\"stylesheet\"]').first(),
                            \$span = \$('<span class=\"fa\" style=\"display:none\"></span>').appendTo('body');
                        if (\$span.css('fontFamily') !== 'FontAwesome' ) {
                            \$fa_cdn.after('<link href=\"";
            // line 23
            echo ($context["T_ASSETS_PATH"] ?? null);
            echo "/css/font-awesome.min.css\" rel=\"stylesheet\">');
                            \$fa_cdn.remove();
                        }
                        \$span.remove();
                    })(jQuery);
                </script>
            ";
        }
        // line 30
        echo "

            ";
        // line 32
        // line 33
        echo "
            ";
        // line 34
        if (($context["S_PLUPLOAD"] ?? null)) {
            $location = "plupload.html";
            $namespace = false;
            if (strpos($location, '@') === 0) {
                $namespace = substr($location, 1, strpos($location, '/') - 1);
                $previous_look_up_order = $this->env->getNamespaceLookUpOrder();
                $this->env->setNamespaceLookUpOrder(array($namespace, '__main__'));
            }
            $this->loadTemplate("plupload.html", "overall_footer_simplified.html", 34)->display($context);
            if ($namespace) {
                $this->env->setNamespaceLookUpOrder($previous_look_up_order);
            }
        }
        // line 35
        echo "            ";
        echo twig_get_attribute($this->env, $this->source, ($context["definition"] ?? null), "SCRIPTS", [], "any", false, false, false, 35);
        echo "

            ";
        // line 37
        if (($context["STYLE_SETTINGS_CONFIG_DARK_TOGGLE"] ?? null)) {
            // line 38
            echo "            \t";
            $asset_file = "js.cookie.js";
            $asset = new \phpbb\template\asset($asset_file, $this->env->get_path_helper(), $this->env->get_filesystem());
            if (substr($asset_file, 0, 2) !== './' && $asset->is_relative()) {
                $asset_path = $asset->get_path();                $local_file = $this->env->get_phpbb_root_path() . $asset_path;
                if (!file_exists($local_file)) {
                    $local_file = $this->env->findTemplate($asset_path);
                    $asset->set_path($local_file, true);
                }
            }
            
            if ($asset->is_relative()) {
                $asset->add_assets_version($this->env->get_phpbb_config()['assets_version']);
            }
            $this->env->get_assets_bag()->add_script($asset);            // line 39
            echo "            ";
        }
        // line 40
        echo "
    
            <script>                
                // ************************************************
                // clear mechanism (for testing)
                // localStorage.removeItem('user_colour_selection');
                // ************************************************                
                console.log(\"storage value:\" + localStorage.user_colour_selection)
                FDSetClass();
                FDSetSwitch();
                
                localStorage.getItem(\"user_colour_selection\")                

                function FDSetClass() {
                    ";
        // line 54
        if ((($context["STYLE_SETTINGS_CONFIG_BASE_COLOUR"] ?? null) == "Dark")) {
            // line 55
            echo "                        console.log(\"FD Base: Dark\");
                        ";
            // line 56
            if (($context["STYLE_SETTINGS_CONFIG_ALLOW_USER_COLOUR"] ?? null)) {
                // line 57
                echo "                            console.log(\"FD: Override allowed\");
                            if(localStorage.user_colour_selection == 'dark') {
                                console.log(\"FD: User selection: Dark\");
                                \$(\"html\").addClass('fd_dark');
                                localStorage.setItem(\"user_colour_selection\", \"dark\");
                            } else {
                                if (localStorage.user_colour_selection == 'cbu') {
                                    console.log(\"FD: cbu. Removing dark class...\");
                                    \$(\"html\").removeClass('fd_dark');
                                } else {
                                    console.log(\"FD: Value is empty. Setting to dark...\");
                                    \$(\"html\").addClass('fd_dark');
                                    localStorage.setItem(\"user_colour_selection\", \"dark\");                                       
                                }                                                          
                            }
                        ";
            } else {
                // line 73
                echo "                            console.log(\"FD: Override not allowed\");
                            console.log(\"Apply dark\");
                            \$(\"html\").addClass('fd_dark');
                            localStorage.setItem(\"user_colour_selection\", \"dark\");
                        ";
            }
            // line 78
            echo "                    ";
        } else {
            // line 79
            echo "                        console.log(\"FD Base: Light\");
                        ";
            // line 80
            if (($context["STYLE_SETTINGS_CONFIG_ALLOW_USER_COLOUR"] ?? null)) {
                // line 81
                echo "                            console.log(\"FD: Override allowed\");
                            if(localStorage.user_colour_selection == 'dark') {
                                console.log(\"FD: User selection: Dark\");
                                \$(\"html\").addClass('fd_dark');
                                localStorage.setItem(\"user_colour_selection\", \"dark\");
                            } else {
                                console.log(\"FD: User selection: Empty\");
                            }                        
                        ";
            } else {
                // line 90
                echo "                            console.log(\"FD: Override not allowed\");
                            console.log(\"FD: Do nothing\");
                        ";
            }
            // line 93
            echo "                    ";
        }
        // line 94
        echo "                }

                function FDSetSwitch() {
                    if (\$(\"html\").hasClass('fd_dark')) {
                        \$(\"a#dark_toggle_link i\").addClass(\"fa-lightbulb-o\");
                    } else {
                        \$(\"a#dark_toggle_link i\").addClass(\"fa-moon-o\");
                    }
                }

                function FDSwitchLink() {
                    if(localStorage.user_colour_selection == 'dark') {
                        // Dark
                        \$(\"a#dark_toggle_link i\").removeClass(\"fa-lightbulb-o\");
                        \$(\"a#dark_toggle_link i\").addClass(\"fa-moon-o\");
                        \$(\"html\").removeClass('fd_dark');
                        localStorage.setItem(\"user_colour_selection\", \"cbu\");
                        console.log(\"Dark preference CBU (cleared by user)\");
                    } else {
                        // Light
                        \$(\"a#dark_toggle_link i\").removeClass(\"fa-moon-o\");
                        \$(\"a#dark_toggle_link i\").addClass(\"fa-lightbulb-o\");
                        localStorage.setItem(\"user_colour_selection\", \"dark\");
                    }
                }                                    

                ";
        // line 120
        if (($context["STYLE_SETTINGS_CONFIG_ALLOW_USER_COLOUR"] ?? null)) {
            // line 121
            echo "                    \$(\"a#dark_toggle_link\").click(function() {
                        FDSwitchLink();
                        FDSetClass();
                    });
                ";
        }
        // line 126
        echo "            </script>             

</body>
</html>
";
    }

    public function getTemplateName()
    {
        return "overall_footer_simplified.html";
    }

    public function isTraitable()
    {
        return false;
    }

    public function getDebugInfo()
    {
        return array (  285 => 126,  278 => 121,  276 => 120,  248 => 94,  245 => 93,  240 => 90,  229 => 81,  227 => 80,  224 => 79,  221 => 78,  214 => 73,  196 => 57,  194 => 56,  191 => 55,  189 => 54,  173 => 40,  170 => 39,  155 => 38,  153 => 37,  147 => 35,  133 => 34,  130 => 33,  129 => 32,  125 => 30,  115 => 23,  108 => 18,  106 => 17,  103 => 16,  88 => 15,  74 => 14,  68 => 13,  65 => 12,  57 => 10,  55 => 9,  50 => 7,  46 => 5,  42 => 4,  37 => 1,);
    }

    public function getSourceContext()
    {
        return new Source("", "overall_footer_simplified.html", "");
    }
}
