Jump to content

Edit History

Alexandre Carette

Alexandre Carette

voici,  attention dans le webpack de mon theme je n installe pas jquery, j appelle la derniere version que pour certaine page (ex: order), cdt

    public function setMedia()
    {
        parent::setMedia();
        $page = $this->context->controller->php_self;
        //$this->unregisterJavascript('corejs');
        $this->unregisterJavascript('jquery-ui');
        $this->unregisterJavascript('jquery-fancybox');
        $this->unregisterStylesheet('jquery-ui');
        $this->registerJavascript('baba_starter-classic', '/assets/js/app.js' , ['position' => 'bottom', 'priority' => 1]);
       
        // COVERAGE //
        if ($page == "index") {
            //$this->registerJavascript('baba_starter-list', '/assets/js/list.js', ['position' => 'bottom', 'priority' => 99]);

           
            if ($this->context->isMobile() == true) {
                
                $this->unregisterStylesheet('theme-main');
                $this->registerStylesheet('mobile-index', '/assets/css/mobile-index.css', ['media' => 'all', 'priority' => 50]);

            } else {
                $this->unregisterStylesheet('theme-main');
                $this->unregisterStylesheet('mobile-index');
                $this->registerStylesheet('desktop-index', '/assets/css/desktop-index.css', ['media' => 'all', 'priority' => 50]);
            }
            
        } else {
            $this->registerStylesheet('theme-main', '/assets/css/theme.css', ['media' => 'all', 'priority' => 50]);
        }

        //$this->registerJavascript('baba_starter-lazysizes', '/assets/js/lazysizes.min.js', ['position' => 'bottom', 'priority' => 3]);
      
      if ($page == "order") {
        $this->registerJavascript('baba_starter-jquery', '/assets/js/jquery-3.6.0.min.js', ['position' => 'bottom', 'priority' => 1]);
        $this->registerJavascript('baba_starter-classic', '/assets/js/theme-classic.js', ['position' => 'bottom', 'priority' => 2]);
        $this->registerJavascript('baba_starter-classic-jqueryUi', '/assets/js/jquery-ui.min.js' , ['position' => 'bottom', 'priority' => 3]);

        //$this->registerJavascript('baba_starter-jquery', '/assets/js/jquery-3.6.0.min.js', ['position' => 'bottom', 'priority' => 1]);
        //$this->registerJavascript('baba_starter-jquery-ui', '/assets/js/jquery-ui.min.js', ['position' => 'bottom', 'priority' => 2]);
         //$this->registerJavascript('baba_starter-bootjs', '/assets/js/bootstrap.4.5.3.min.js', ['position' => 'bottom', 'priority' => 3]);
        }



    // Execute Hook FrontController SetMedia
        Hook::exec('actionFrontControllerSetMedia', []);

        return true;

    }

 

Alexandre Carette

Alexandre Carette

voici, cdt

    public function setMedia()
    {
        parent::setMedia();
        $page = $this->context->controller->php_self;
        //$this->unregisterJavascript('corejs');
        $this->unregisterJavascript('jquery-ui');
        $this->unregisterJavascript('jquery-fancybox');
        $this->unregisterStylesheet('jquery-ui');
        $this->registerJavascript('baba_starter-classic', '/assets/js/app.js' , ['position' => 'bottom', 'priority' => 1]);
       
        // COVERAGE //
        if ($page == "index") {
            //$this->registerJavascript('baba_starter-list', '/assets/js/list.js', ['position' => 'bottom', 'priority' => 99]);

           
            if ($this->context->isMobile() == true) {
                
                $this->unregisterStylesheet('theme-main');
                $this->registerStylesheet('mobile-index', '/assets/css/mobile-index.css', ['media' => 'all', 'priority' => 50]);

            } else {
                $this->unregisterStylesheet('theme-main');
                $this->unregisterStylesheet('mobile-index');
                $this->registerStylesheet('desktop-index', '/assets/css/desktop-index.css', ['media' => 'all', 'priority' => 50]);
            }
            
        } else {
            $this->registerStylesheet('theme-main', '/assets/css/theme.css', ['media' => 'all', 'priority' => 50]);
        }

        //$this->registerJavascript('baba_starter-lazysizes', '/assets/js/lazysizes.min.js', ['position' => 'bottom', 'priority' => 3]);
      
      if ($page == "order") {
        $this->registerJavascript('baba_starter-jquery', '/assets/js/jquery-3.6.0.min.js', ['position' => 'bottom', 'priority' => 1]);
        $this->registerJavascript('baba_starter-classic', '/assets/js/theme-classic.js', ['position' => 'bottom', 'priority' => 2]);
        $this->registerJavascript('baba_starter-classic-jqueryUi', '/assets/js/jquery-ui.min.js' , ['position' => 'bottom', 'priority' => 3]);

        //$this->registerJavascript('baba_starter-jquery', '/assets/js/jquery-3.6.0.min.js', ['position' => 'bottom', 'priority' => 1]);
        //$this->registerJavascript('baba_starter-jquery-ui', '/assets/js/jquery-ui.min.js', ['position' => 'bottom', 'priority' => 2]);
         //$this->registerJavascript('baba_starter-bootjs', '/assets/js/bootstrap.4.5.3.min.js', ['position' => 'bottom', 'priority' => 3]);
        }



    // Execute Hook FrontController SetMedia
        Hook::exec('actionFrontControllerSetMedia', []);

        return true;

    }

 

×
×
  • Create New...