<?php
    /**
    *
    * copyright (c) 2013-2018 Heliac Technologies
    * license http://opensource.org/licenses/gpl-license.php GNU GPL v3 
    *
    * linee guida per l'utilizzo del logo http://www.geecom.org/articolo.php?id=34&alias=linee-guida-per-l%27uso-del-logo-geecom
    */

    /*
            include il css comune a tutte le pagine, più la favicon
    */

    if($impostazioni["ottimizzazioneUrl"]=="si") {
        if(strpos($_SERVER["PHP_SELF"],"articolo.php")>-1) {
            $prefissoTemplate = "../../";
        }
        else if(strpos($_SERVER["PHP_SELF"],"categoria.php")>-1) {
            $prefissoTemplate = "../../";
        }
        else { //pagina index oppure pagina contatti oppure pagina blog o risorse
            $prefissoTemplate = "";	
        }
    }
    else {
            $prefissoTemplate = "";
    }
?>
    <!-- jQuery -->
    <script src="<?php echo $prefissoTemplate; ?>plugins/jQuery/jquery-3.4.1.min.js" type="text/javascript"></script>
    <script src="<?php echo $prefissoTemplate; ?>js/util.js"></script>
    <script src="<?php echo $prefissoTemplate; ?>plugins/bootstrap/bootstrap.min.js" type="text/javascript"></script>
    
    <!-- Plugins -->  
    <script src="<?php echo $prefissoTemplate; ?>template/js/animateHeader.js"></script>
    <script src="<?php echo $prefissoTemplate; ?>template/js/ricercaFullScreen.js"></script>
    <script src="<?php echo $prefissoTemplate; ?>template/js/accordion.js"></script>
    <script src="<?php echo $prefissoTemplate; ?>template/js/jquery.mixitup.min.js"></script>
    <script src="<?php echo $prefissoTemplate; ?>plugins/hamburger/hamburgers.js"></script>
    <script src="<?php echo $prefissoTemplate; ?>plugins/popper/popper.min.js"></script>    
    <!-- Cookie law bar -->
    <script>
        $("#cookie-law-bar").addClass("load");
    </script>
    
    <script type="text/javascript">
        $(document).ready(function () {
            $('#sidebarCollapse').on('click', function () {
                $('#sidebar').toggleClass('active');
        $('#content').toggleClass('extramargin');
            });
        });
    </script>
    
    <!-- Tag Inputs -->
    <script type="text/javascript" src="<?php echo $prefissoTemplate; ?>plugins/tagsinput/tagsinput.js"></script>
    <script type="text/javascript" src="<?php echo $prefissoTemplate; ?>plugins/tagsinput/typeahead.js"></script>
    
    <!-- Hamburger menu -->
    <script>
        var hamburger = document.querySelector(".hamburger");
            hamburger.addEventListener("click", function() {
            hamburger.classList.toggle("is-active");
        });
    </script>
    
    <!-- Animate on Scroll -->
    <script src="<?php echo $prefissoTemplate; ?>plugins/aos/aos.js"></script>
    <script>
        AOS.init({
            easing: 'ease-in-out-sine'
        });
    </script>
    
    <script src="plugins/tinymce/tinymce.min.js" type="text/javascript"></script>
    <script>
        // utilizzato nelle comunicazioni (crea ticket e segnalazione)
        tinymce.init({
            selector:'.tiny',
            language: 'it',
            plugins: "textcolor link pagebreak code media lists advlist",
            menubar:false,
            toolbar: 'insert | undo redo |  formatselect | bold italic backcolor  | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | removeformat | help',
            branding:false
        });
    </script>

    <!-- Dropzone -->
    <script type="text/javascript" src="plugins/dropzone/dropzone.js"></script>
    <script>
        $(".singolo-file").dropzone({
            acceptedFiles: ".jpeg,.jpg,.png,.gif,.svg",
            maxFiles: 1,
            addRemoveLinks: true,
            dictRemoveFile: "Rimuovi",
            success: function(file,percorso) {
                document.getElementById("fotoUtente").src=percorso;
                this.removeAllFiles();
            },
            params:{
                operazione:"cambiaFotoProfilo",
                id:<?php echo $_SESSION["geecomUser_id"] ?>
            },
            maxfilesexceeded: function(file) {
                this.removeAllFiles();
                this.addFile(file);
            }
        })
    </script>

    <!-- VIDE -->
    <script src="https://cdnjs.cloudflare.com/ajax/libs/vide/0.5.1/jquery.vide.min.js"></script>    
    <?php 
        /*
         *  se mi trovo nelle pagine index.php o articolo.php uso il gestoreJavascript
         *  per gestire gli slider
         */
        
        $gestoreJavascript->stampaJavascript();
