Hai Truong IT
Hai Truong IT

Reputation: 4187

How to turn off mootools in joomla 1.5 in backend

I am using jquery, but it conflicts with mootools. How do I turn off mootools in administrator of joomla 1.5?

Upvotes: 1

Views: 2734

Answers (3)

Egeshi
Egeshi

Reputation: 114

I am using following to completely remove Mootools and standard behaviors from Joomla 2.5. Just add following to your template's index.php

$headerstuff = $this->getHeadData();
foreach ($headerstuff['scripts'] as $k=>$item) {
 if (stristr($k, 'mootools-core.js'))
 unset($headerstuff['scripts'][$k]);
 if (stristr($k, 'mootools-more.js'))
 unset($headerstuff['scripts'][$k]);
 if (stristr($k, 'caption.js'))
 unset($headerstuff['scripts'][$k]);
 if (stristr($k, 'validate.js'))
 unset($headerstuff['scripts'][$k]);
}
$this->setHeadData($headerstuff);

if (isset($this->_script['text/javascript'])) {
 $this->_script['text/javascript'] = preg_replace('%window\.addEvent\(\'load\',\s*function\(\)\s*{\s*new\s*JCaption\(\'img.caption\'\);\s*}\);\s*%', '', $this->_script['text/javascript']);
 if (empty($this->_script['text/javascript']))
 unset($this->_script['text/javascript']);

 $this->_script['text/javascript'] = preg_replace( '/window\.addEvent[a-zA-Z0-9\(\)\{\}\s*=\.\';:,\[\]\$]+/mi', '',  $this->_script['text/javascript']);
 if (empty($this->_script['text/javascript']))
 unset($this->_script['text/javascript']);
}
$doc = JFactory::getDocument();
$doc->addScript('http://code.jquery.com/jquery-1.7.2.min.js', false);
$doc->addScript('...', false);
...

Upvotes: 0

Søren Beck Jensen
Søren Beck Jensen

Reputation: 1676

You can not run the Joomla admin without the Mootools library, but you can run both without any conflict. You just have to use the following code when you use jQuery

var $jq = jQuery.noConflict();

jQuery(document).ready(function($){
    // your doc ready code...
});

Upvotes: 3

Sudhir Bastakoti
Sudhir Bastakoti

Reputation: 100175

I think this link shows how to do it: Disable Mootools

You might have to tweak a little for disabling it in backend only. Hope it helps

Upvotes: 0

Related Questions