Modules and unnecessary scripts

08.01.2023 14:14
#1
kosh2323
Joomshopping forum user no avatar
Name: Jory
14.03.2021
Posts: 49
Quote
Modules and unnecessary scripts

When installing one module "Joomshopping search" loads a lot of scripts, why load the whole bootstrap there, and separately, why is there Jquery?

Even Joomla itself doesn't use it anymore. How to get rid of these unnecessary scripts, and leave only what is needed when using modules. Agree, for example, you do not need to download /media/vendor/bootstrap/js/jcarousel.min.js ?5.1.3 for the "search" module.

And then in Joomla itself, Bootstrap styles and scripts are already preloaded, why download them again?

Modules and unnecessary scripts


Modules and unnecessary scripts


Last change: 08.01.2023 14:15
 
08.01.2023 15:47
#2
admin
(Support Team)
User admin
Name: Admin
05.08.2010
Posts: 25941
Quote
Aw: Modules and unnecessary scripts

Code in JoomShopping (5.1.2)

public static function loadJsFiles(){
static $load;
if (!$load){
$jshopConfig = \JSFactory::getConfig();
$document = \JFactory::getDocument();
if ($jshopConfig->load_javascript) {
if ($jshopConfig->load_javascript_bootstrap) {
HTMLHelper::_('bootstrap.framework');
}
if ($jshopConfig->load_javascript_jquery) {
HTMLHelper::_('jquery.framework');
}
$document->addScript($jshopConfig->file_functions_js);
}
$load = 1;
}
}

---------------------------------------------------------------
For disable

components\com_jshopping\config\default_config.php
$config->load_javascript_bootstrap = 0;
$config->load_javascript_jquery = 0;


Last change: 08.01.2023 15:48
 
08.01.2023 17:04
#3
kosh2323
Joomshopping forum user no avatar
Name: Jory
14.03.2021
Posts: 49
Quote
Aw: Modules and unnecessary scripts

admin - 08.01.2023 15:47
Code in JoomShopping (5.1.2)

public static function loadJsFiles(){
static $load;
if (!$load){
$jshopConfig = \JSFactory::getConfig();
$document = \JFactory::getDocument();
if ($jshopConfig->load_javascript) {
if ($jshopConfig->load_javascript_bootstrap) {
HTMLHelper::_('bootstrap.framework');
}
if ($jshopConfig->load_javascript_jquery) {
HTMLHelper::_('jquery.framework');
}
$document->addScript($jshopConfig->file_functions_js);
}
$load = 1;
}
}

---------------------------------------------------------------
For disable

components\com_jshopping\config\default_config.php
$config->load_javascript_bootstrap = 0;
$config->load_javascript_jquery = 0;


Thanks for the answer, I checked all the modules, and only one "Joomshopping search" module loads all bootstrap scripts, the rest do not load anything superfluous.

This is disabled in this file components\com_jshopping\config\default_config.php.

1. And here is the code above for which file, where to insert it?
2. I do not know if bootstrap is used in other modules, scripts or styles. Maybe it's easier to disable it in one "search module", and how to do it only for this module?

 
09.01.2023 11:40
#4
admin
(Support Team)
User admin
Name: Admin
05.08.2010
Posts: 25941
Quote
Aw: Modules and unnecessary scripts

See module:
mod_jshopping_search.php

\JSFactory::loadJsFiles();

-------------------------------
Bug after delete.

---------

 
09.01.2023 14:45
#5
kosh2323
Joomshopping forum user no avatar
Name: Jory
14.03.2021
Posts: 49
Quote
Aw: Modules and unnecessary scripts

admin - 09.01.2023 11:40
See module:
mod_jshopping_search.php

\JSFactory::loadJsFiles();

-------------------------------
Bug after delete.

---------


Please post the full file code mod_jshopping_search.php . An error is generated when inserting the code.

 
10.01.2023 16:39
#6
kosh2323
Joomshopping forum user no avatar
Name: Jory
14.03.2021
Posts: 49
Quote
Aw: Modules and unnecessary scripts

Tell me all the same how to make the search module not load so many unnecessary scripts, please explain what, what code to insert specifically (in which file and place). Will there be an update of the search module itself in this regard?

 
10.01.2023 17:53
#7
admin
(Support Team)
User admin
Name: Admin
05.08.2010
Posts: 25941
Quote
Aw: Modules and unnecessary scripts

Your need change module.

1. delete
\JSFactory::loadJsFiles();

from
modules\mod_jshopping_search\mod_jshopping_search.php

 
11.01.2023 07:35
#8
kosh2323
Joomshopping forum user no avatar
Name: Jory
14.03.2021
Posts: 49
Quote
Aw: Modules and unnecessary scripts

admin - 10.01.2023 17:53
Your need change module.

1. delete
\JSFactory::loadJsFiles();

from
modules\mod_jshopping_search\mod_jshopping_search.php


Thank you, yes it works.

 


Copyrights MAXXmarketing GmbH. Alle Rechte vorbehalten
Durch die Nutzung dieser Website stimme ich zu, dass Cookies zur optimalen Gestaltung der Website sowie zur Analyse der Nutzung der Website verwendet werden. Weiterführende Informationen finden Sie hier. OK, einverstanden.