4

Apparently I can't have Mootools loaded in my custom back-end component since its colliding and worst even, its manipulating all standard String methods and cause a extreme slow down(crap in String.test patch) and/or crashes all over the place in my Javascript application(ibm-js, modern scripts according to latest stable w3c specs).

So I filtered all Javascript via filtering JFactory::getDocument()->_scripts but it seems to break the admin menu(at least its not working anymore). I also tried every other things found on the internet but with no success.

Does anyone knows the official way to disable MooTools in back-end components whilst not breaking the admin-menu?

If there is no clean way to disable that scripts, what are the alternatives? Currently I see only iFrame as solution (document.write(myHtml)). Or would writing a admin template help you too?

thank you!

(Joomla-3.4.1 with standard plugins like RS-Firewall,...)

Update, this seems to kickoff more-tools-core at least:

JHTML::_( 'behavior.framework', false );
$doc = JFactory::getDocument();
// remove joomla stuff
$doc->_scripts     = null;
$doc->_script      = null;
$doc->_styleSheets = null;
$myComponent->handleRequest();

for some reason "more-tools-more" is still on the page.

  • Is it only MooTools you're trying to disable? – Lodder May 16 '15 at 14:58
  • yes, at least thats what I hope, apparently other scripts seem to do also bs* with native types, causing performance losts, not sure yet. – stackoverclan May 16 '15 at 14:59
  • JHtml::_('behavior.framework') : no; actually I don't want to use anything from Joomla. My component has all by self. I guess i will go with a custom admin template in hope I have a 'clean' page. Thanks! – stackoverclan May 16 '15 at 15:09
  • joomla-extensions.kubik-rubik.de/jcc-js-css-control - the following plugin allows you to disable in the backend any css or js – iamrobert Jan 6 '18 at 14:00
2

If you have the following code anywhere in your component, try removing it:

JHtml::_('behavior.framework');

Else, try using the following which will unset the script from the <head>

$doc     = JFactory::getDocument(); 
$head    = $doc->getHeadData();
$scripts = $head['scripts'];

unset($scripts['/media/system/js/mootools-core.js']);
unset($scripts['/media/system/js/mootools-more.js']);
$head['scripts'] = $scripts;
$doc->setHeadData( $head );   

In regards to your comment:

I believe Mootools is imported via the core, not the template, so changing your template won't make any difference

  • just tried, mootools is still there! Then I tried JFactory::getDocument()->_scripts=array(); which has indeed an impact but it mootools is still there. Also tried combinations of yours with hard reset $head['scripts'] = array() but no, really weird. Is it possible that other plugins can still load mootools ? Because there are many! 'solutions' on the internet, saying more or less the same but never really worked ;-) – stackoverclan May 16 '15 at 15:19
  • thanks for the loaded by 'core' hint. I am really surprised Joomla loads this sort of crap (String.prototype.test patch, jeez....) – stackoverclan May 16 '15 at 15:20
  • Yes, other extensions can load MooTools but the getHeadData should get catch them whilst Joomla is compiling the <head> – Lodder May 16 '15 at 15:20
  • They are in the process of removing Mootools and using jQuery instead. The majority has been done but there are still some bits left ;) – Lodder May 16 '15 at 15:21
  • ok, i will use iframes then, the patches for String are really horrible, in my component, everything slowed down to unusable...its a wonder something works at all ;-) thanks mate! – stackoverclan May 16 '15 at 15:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.